note 118410 added to language.types.null

From: Date: Wed, 02 Dec 2015 15:39:40 +0000
Subject: note 118410 added to language.types.null
Groups: php.notes 
Request: Send a blank email to php-notes+get-204259@lists.php.net to get a copy of this message
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 ---- Server IP: 72.52.91.14 Probable Submitter: 147.142.120.25 ---- Manual Page -- http://php.net/manual/en/language.types.null.php Edit -- https://master.php.net/note/edit/118410 Del: integrated -- https://master.php.net/note/delete/118410/integrated Del: useless -- https://master.php.net/note/delete/118410/useless Del: bad code -- https://master.php.net/note/delete/118410/bad+code Del: spam -- https://master.php.net/note/delete/118410/spam Del: non-english -- https://master.php.net/note/delete/118410/non-english Del: in docs -- https://master.php.net/note/delete/118410/in+docs Del: other reasons-- https://master.php.net/note/delete/118410 Reject -- https://master.php.net/note/reject/118410 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204259) next »