note 64126 deleted from function.current by bjori

From: Date: Mon, 24 Apr 2006 15:12:53 +0000
Subject: note 64126 deleted from function.current by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109453@lists.php.net to get a copy of this message
Note Submitter: metapundit ---- The warning that current returns false if the current array value is a 0 or "" doesn't seem to be true with my version of php (4.3.10). eg $a=array("");var_dump(current($a); prints out string(0) "". Of course if you store the boolean false in your array, you can't rely on current to tell if you're at the end of your array anyway since it will return false as a value and also false as the end of the array... Is the best safe equivalent to if(current($array) === false) to use instead if(!is_null(key($array)) Seems safe to me since Null is not a valid key and will never be returned by key() unless at the end of the array...

« previous php.notes (#109453) next »