Bug #18543 Updated: Array returned from function with pointer at end
ID: 18543
Updated by: derick@php.net
Reported By: mikeboulet@newfangled.com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Win2K/Linux RH 7.1
PHP Version: 4.2.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use reset() or foreach()
Previous Comments:
------------------------------------------------------------------------
[2002-07-24 13:28:45] mikeboulet@newfangled.com
It is expected that the $msgs array passed back out of the test()
function call would have a pointer pointing to the first item. I
confirmed that this works correctly under PHP 4.0.6.
It doesn't work under 4.2.1 either.
Notice the output of the print_r()
// TEST SCRIPT
$newmsgs = test();
print_r( current( $newmsgs ));
function test()
{
$msgs[][a] = 10;
$msgs[][b] = 20;
$msgs[][c] = 30;
$msgs[][d] = 40;
$msgs[][e] = 50;
while( list( $idx, $msg ) = each( $msgs ) )
{
}
return $msgs;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18543&edit=1
Thread (3 messages)