| 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:
Posts (Atom)
-
https://www.nicesnippets.com/blog/laravel-9-comment-system-example-tutorial
-
Organization : Keeping each site's configuration in separate files makes the server easier to manage, especially when hosting multiple...
-
On one end of the spectrum, you have your no-code dogmatics. On the other end, you have your fancy tech stack enthusiasts. In the middle a...