note 15629 added to function.array-push

From: Date: Mon, 24 Sep 2001 08:34:13 +0000
Subject: note 15629 added to function.array-push
Groups: php.notes 
Request: Send a blank email to php-notes+get-18237@lists.php.net to get a copy of this message
// insert a value at the specified position into an array // Author: Volker Richter function array_insert($source, $newvar, $source_place ) { $elements=count($source); if($source_place==0) { array_unshift($source,$newvar); return $source; } if($source_place>$elements) { $source[]=$newvar; return $source; } for($i=0;$i<$source_place;$i++) $temp[]=$source[$i]; $temp[]=$newvar; for($i=$source_place;$i<count($source);$i++) $temp[]=$source[$i]; return $temp; } -- http://www.php.net/manual/en/function.array-push.php http://master.php.net/manage/user-notes.php?action=edit+15629 http://master.php.net/manage/user-notes.php?action=delete+15629 http://master.php.net/manage/user-notes.php?action=reject+15629

« previous php.notes (#18237) next »