|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-15 10:46 UTC] dave at emaildienst dot de
Description:
------------
when doing an array reverse with the "preserve keys" switch, just the
values should be reversed. in fact it makes no difference if the
preserve keys switch is true or not.
Reproduce code:
---------------
$array[0] = 3;
$array[1] = 1;
$array[2] = 2;
$firsNewArray=array_reverse($array);
$secondNewArray=array_reverse($array, true);
Expected result:
----------------
$firstNewArray
(
[2] => 2
[1] => 1
[0] => 3
)
$secondNewArray
(
[0] => 2
[1] => 1
[2] => 3
)
Actual result:
--------------
$firstNewArray
(
[2] => 2
[1] => 1
[0] => 3
)
$secondNewArray
(
[2] => 2
[1] => 1
[0] => 3
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Jan 17 21:00:01 2026 UTC |
Cannot reproduce. This is what I get: array(3) { [0]=> int(2) [1]=> int(1) [2]=> int(3) } array(3) { [2]=> int(2) [1]=> int(1) [0]=> int(3) }