| 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:
Comments (Atom)
-
In today’s software development landscape, APIs (Application Programming Interfaces) are essential for enabling communication between differ...
-
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...
-
https://www.positronx.io/build-secure-php-rest-api-in-laravel-with-sanctum-auth/