possible bug in array_reverse() ?
| From: | Wolfgang Drews | Date: | Sun, 09 Dec 2001 15:27:35 +0000 |
| Subject: | possible bug in array_reverse() ? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-72954@lists.php.net to get a copy of this message | ||
Hi all,
i don't know if i got something wrong, therefore no bug-report, as
i don't really know, if this is a bug.
---- snipp ----
$ax = array("a" => "alpha", "b" => "bravo",
"c" => "charlie",
"d" => "delta");
$r = array_reverse($ax);
print_r($r);
for ($i = 0; $i < count($r); $i++)
{
echo "<br>".$i." : ".$r[$i];
}
---- snap -----
actually i thougt, PHP handles associative and numeric arrays the
same way(internally) as they are hashes and therefore it should be possible
to get the values of an associative array through its indices, too.
In the example above there are no values printed in the for-loop.
Strange behaviour?
In addition the optional Flag "bool preserve_keys" doesn't seem to
work on associative arrays. This effect was testet on 4.0.6, 4.2.0 dev
and 4.0.5. Can someone please check this or give me a hint in the
right direction and open my mind?
this one directs you to the same bug but seems to be closed:
http://bugs.php.net/bug.php?id=6684
with best regards,
-Wolfgang
--
German "PHP-Centralstation" Dynamic Web Pages: http://www.dynamicwebpages.de
Scripte, Tutorials, Installation, Bücher, BestofGML, Manual, Links uvm.
PHP 4: Dynamische Webauftritte professionell realisieren: http://php-buch.de