|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-01 13:42 UTC] php at alterego dot dp dot ua
<?
$a = array("a", "b", "c");
each($a);
array_pop($a);
var_dump(each($a));
?>
This prints "bool(false)" in 4.3.0 (current element pointer points somewhere out of the array) and var_dump($a[0]) in 4.2.3 (array is reset after array_pop).
I had to add many additional reset()'s after installing 4.3.0.
How array_pop() (and may be others) affects current element pointer is not documented, so this behavior is not a bug. The only purpose of writing all this is that I want to know how array_pop() will work in future PHP releases.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 21:00:01 2025 UTC |
I just upgraded a machine here from 4.1.2 (redhat default installation) to 4.3.4. while (count($tree) > 1){ $tree[count($tree) - 2]["SELECTED"]["Children"] = $tree[count($tree) - 1]; array_pop($tree); } The above doesn't work after upgrading. We had to change it to this: while (count($tree) > 1){ $tree[count($tree) - 2]["SELECTED"]["Children"] = $tree[count($tree) - 1]; $tree = array_slice($tree,0,count($tree) - 1); } Wasn't this bug sorted out? Thanks.