note 118410 deleted from language.types.null by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:55:56 +0000 |
| Subject: | note 118410 deleted from language.types.null by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210840@lists.php.net to get a copy of this message | ||
Note Submitter: sebastian dot goendoer at NOSPAM dot telekom dot de
----
Valiable values of (almost) all types that can be juggled to something "like" NULL will
eval to NULL:
<?php
$test['_string'] = "";
$test['_int'] = 0;
$test['_float'] = 0.0;
$test['_null'] = null;
$test['_arr'] = array();
$test['_obj'] = new \stdClass();
foreach($test as $key => $value)
{
echo $key.": ";
if($value == null)
echo "is null\n";
else
echo "is not null\n";
}die();
?>
will give you
_string: is null
_int: is null
_float: is null
_null: is null
_arr: is null
_obj: is not null