Re: RE: PHP 4.0 Bug #8106 Updated: array_pop problem when using against an array returned from a class

From: Date: Thu, 07 Dec 2000 05:34:13 +0000
Subject: Re: RE: PHP 4.0 Bug #8106 Updated: array_pop problem when using against an array returned from a class
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-40310@lists.php.net to get a copy of this message
I think array_pop() returns NULL to indicate it has no further elements. This is just in case you are saving bool() values in the array. It makes more sense. Andi At 03:23 AM 12/7/00 +0200, Jani Taskinen wrote:
On Wed, 6 Dec 2000, Andi Gutmans wrote: At 01:17 AM 12/6/00 +0200, Jani Taskinen wrote:
$number = array_pop($output);
Does anyone (php-dev) have any objections to not to make array_pop() return FALSE on this error? (when the $output is not an array) Or am I missing something here?
Can you explain the problem? I missed it somehow :) <?php $test = array(); $ret = @array_pop($test); var_dump($ret); if($ret === FALSE) echo "Error.."; echo "<br>"; $test = "abc"; $ret = @array_pop($test); var_dump($ret); if($ret === FALSE) echo "Error.."; ?> Now this prints: NULL NULL And which I think it should print: NULL bool(false) Error.. --Jani
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#40310) next »