| Value of variable ($var) | isset($var) | empty($var) | is_null($var) |
|---|---|---|---|
| “” (an empty string) | bool(true) | bool(true) | |
| ” ” (space) | bool(true) | ||
| FALSE | bool(true) | bool(true) | |
| TRUE | bool(true) | ||
| array() (an empty array) | bool(true) | bool(true) | |
| NULL | bool(true) | bool(true) | |
| “0” (0 as a string) | bool(true) | bool(true) | |
| 0 (0 as an integer) | bool(true) | bool(true) | |
| 0.0 (0 as a float) | bool(true) | bool(true) | |
| var $var; (a variable declared, but without a value) | bool(true) | bool(true) | |
| NULL byte (“\ 0”) | bool(true) |
Sunday, December 1, 2019
PHP isset() vs empty() vs is_null()
Subscribe to:
Post Comments (Atom)
-
Implementing the Repository Pattern with CakePHP I must admit, my recent articles are becoming a bit obsessed around the repository pat...
-
Organization : Keeping each site's configuration in separate files makes the server easier to manage, especially when hosting multiple...
-
What is a closure? A closure is an inner function that has access to the outer (enclosing) function’s variables—scope chain. The closure h...
No comments:
Post a Comment