User Tools

Site Tools


conventions:php_null

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
php_null [2021/08/17 16:04] diogophp_null [2021/08/18 18:35] – Add Eliseu's vote diogo
Line 1: Line 1:
 ====== The absence of value ====== ====== The absence of value ======
 +
 <markdown> <markdown>
 When programming in PHP it's common having to represent the absence of value. When programming in PHP it's common having to represent the absence of value.
Line 58: Line 59:
 A non-void function, by definition, is expected to return a value. A non-void function, by definition, is expected to return a value.
 If it couldn't and didn't run on an exceptional scenario, then you should test in a different style from that of regular If it couldn't and didn't run on an exceptional scenario, then you should test in a different style from that of regular
-strict comparison. Hence, as you're testing whether a variable is of type null, then you should use `is_null($var)`.+strict comparison. Hence, as you're testing whether a variable resulting of a union of types is of type null, then you should use `is_null($var)`. It's about verifying if a variable is in a state in which holds a value.
 Just as you normally would with an `is_int($var)`  or `is_countable($var)`. Just as you normally would with an `is_int($var)`  or `is_countable($var)`.
 </markdown> </markdown>
Line 65: Line 66:
  
 <markdown> <markdown>
-Voter|is_null|=== null +Voter    `is_null()` `=== null` 
------|-------|--------+---------|-------------|--------
 +XRevan86 |X            |- 
 +Diogo    |X            |- 
 +Hugo     |-            |X 
 +Eliseu   |X            |X
  
 </markdown> </markdown>
conventions/php_null.txt · Last modified: 2021/12/08 00:28 by diogo