#41396 [Opn->Fbk]: array_reverse -> preserve keys switch not working

From: Date: Wed, 16 May 2007 12:57:18 +0000
Subject: #41396 [Opn->Fbk]: array_reverse -> preserve keys switch not working
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112691@lists.php.net to get a copy of this message
ID: 41396 Updated by: tony2001@php.net Reported By: dave at emaildienst dot de -Status: Open +Status: Feedback Bug Type: Arrays related Operating System: Debian Etch PHP Version: 5.2.2 New Comment: 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) } Previous Comments: ------------------------------------------------------------------------ [2007-05-15 10:46:00] 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 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41396&edit=1

« previous php.bugs (#112691) next »