note 40269 added to function.array-unshift

From: Date: Thu, 26 Feb 2004 23:02:00 +0000
Subject: note 40269 added to function.array-unshift
Groups: php.notes 
Request: Send a blank email to php-notes+get-65852@lists.php.net to get a copy of this message
unshifting of a reference ! <?php /** * @return int * @param $array array * @param $value mixed * @desc Prepend a reference to an element to the beginning of an array. Renumbers numeric keys, so $value is always inserted to $array[0] */ function array_unshift_ref(&$array, &$value) { $return = array_unshift($array,''); reset($array); $array[key($array)] =& $value; return $return; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-unshift.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40269 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40269&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40269&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65852) next »