I retrieve some data from my own store, and in case of failure I get a very specific answer. Calling strlen() for this variable returns 0. It is also not NULL or "". I use this code to check:
if ($data === NULL) { echo("data was null\n"); } else if ($data === "") { echo("data was empty string\n"); } else if (strlen($data) == 0) { echo("data was length zero\n"); }
This result outputs data was length zero . What can a variable contain: zero length, not zero, not an empty string?
source share