php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11342 array_shift & array_pop element whith value 0 don't work
Submitted: 2001-06-07 20:59 UTC Modified: 2001-06-08 14:29 UTC
From: jd at linuxrea dot net Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.4pl1 OS: mandrake 8.0
Private report: No CVE-ID: None
 [2001-06-07 20:59 UTC] jd at linuxrea dot net
if i do $minutes=array(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55);

and after i do :
while($vname = array_shift($minutes))
{
	print "$vname<br>\n";
}
i have nothing in output

and if i do after:

while($vname = array_pop($minutes))
{
	print "$vname<br>\n";
}

I've all values except the '0'.

Julien dumont
 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-08 14:29 UTC] sniper@php.net
Not a bug. In PHP 0 is treated as NULL.
You have to check it with !== or === which checks the type.

if($vname!==NULL)

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 16:01:33 2024 UTC