note 15627 added to function.array-unshift

From: Date: Mon, 24 Sep 2001 08:32:19 +0000
Subject: note 15627 added to function.array-unshift
Groups: php.notes 
Request: Send a blank email to php-notes+get-18235@lists.php.net to get a copy of this message
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-unshift.php http://master.php.net/manage/user-notes.php?action=edit+15627 http://master.php.net/manage/user-notes.php?action=delete+15627 http://master.php.net/manage/user-notes.php?action=reject+15627

« previous php.notes (#18235) next »