note 17650 added to function.array-push

From: Date: Tue, 18 Dec 2001 14:22:36 +0000
Subject: note 17650 added to function.array-push
Groups: php.notes 
Request: Send a blank email to php-notes+get-23127@lists.php.net to get a copy of this message
function array_insert($source,$new,$pos){ array_splice($source,$pos,0,array($new)); return $source; } This does the exact same thing as Volker's array_insert. It differs from Khan's array_intervene in that it does not padd the end of the array with empty elements if $pos > count($source) It also works correctly if $new is an array. Try also : $foo = array('one','four'); array_splice($foo,1,0,array('two','three')); print_r($foo); Ivan -- http://www.php.net/manual/en/function.array-push.php http://master.php.net/manage/user-notes.php?action=edit+17650 http://master.php.net/manage/user-notes.php?action=delete+17650 http://master.php.net/manage/user-notes.php?action=reject+17650

« previous php.notes (#23127) next »