note 28725 added to function.array-push

From: Date: Wed, 22 Jan 2003 13:23:15 +0000
Subject: note 28725 added to function.array-push
Groups: php.notes 
Request: Send a blank email to php-notes+get-42586@lists.php.net to get a copy of this message
For the note above: you can use array_splice function to insert a new value (or array) in the middle of array, this will work like your code does: $list = array( "0" => "zero", "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five", "6" => "six" ); $value = "New Number Three"; $key = "3"; $new = array_splice($list, $key, 0, $value); -- http://www.php.net/manual/en/function.array-push.php http://master.php.net/manage/user-notes.php?action=edit+28725 http://master.php.net/manage/user-notes.php?action=delete+28725 http://master.php.net/manage/user-notes.php?action=reject+28725

« previous php.notes (#42586) next »