note 37109 added to function.array-merge

From: Date: Mon, 03 Nov 2003 17:43:24 +0000
Subject: note 37109 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-59726@lists.php.net to get a copy of this message
While searching for a function that would renumber the keys in a array, I found out that array_merge() does this if the second parameter is null: Starting with array $a like: Array ( [5] => 5 [4] => 4 [2] => 2 [9] => 9 ) Then use array_merge() like this: $a = array_merge($a, null); Now the $a array has bee renumbered, but maintaining the order: Array ( [0] => 5 [1] => 4 [2] => 2 [3] => 9 ) Hope this helps someone :-) ---- Manual Page -- http://www.php.net/manual/en/function.array-merge.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37109 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37109&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37109&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59726) next »