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)
-
Composer is a major part of the Laravel MVC Framework, but it also exists without Laravel. In fact you could use it in any project. This a...
-
How to Answer Technical Questions Like a Pro Answering technical interview questions is all about showing off your problem-solving skills an...
-
Vuetify is a popular UI framework for Vue apps. In this article, we’ll look at how to work with the Vuetify framework. Color Picker Inputs W...