note 109566 added to function.array-reverse

From: Date: Sun, 29 Jul 2012 10:35:47 +0000
Subject: note 109566 added to function.array-reverse
Groups: php.notes 
Request: Send a blank email to php-notes+get-189451@lists.php.net to get a copy of this message
With array_reverse() if the keys are strings, they remain the same, example: <?php $a = array ("zero"=>"hello","one"=>"world"); var_dump (array_reverse($a)); ?> Outputs: array(2) { ["one"]=> string(5) "world" ["zero"]=> string(5) "hello" } But if the keys are numbers, they will be changed starting from 0, example: <?php $a = array (10=>"hello",20=>"world"); var_dump (array_reverse($a)); ?> Outputs: array(2) { [0]=> string(5) "world" [1]=> string(5) "hello" } ---- Server IP: 69.147.83.197 Probable Submitter: 2.226.131.71 ---- Manual Page -- http://www.php.net/manual/en/function.array-reverse.php Edit -- https://master.php.net/note/edit/109566 Del: integrated -- https://master.php.net/note/delete/109566/integrated Del: useless -- https://master.php.net/note/delete/109566/useless Del: bad code -- https://master.php.net/note/delete/109566/bad+code Del: spam -- https://master.php.net/note/delete/109566/spam Del: non-english -- https://master.php.net/note/delete/109566/non-english Del: in docs -- https://master.php.net/note/delete/109566/in+docs Del: other reasons-- https://master.php.net/note/delete/109566 Reject -- https://master.php.net/note/reject/109566 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189451) next »