note 40270 added to function.array-unshift

From: Date: Thu, 26 Feb 2004 23:20:45 +0000
Subject: note 40270 added to function.array-unshift
Groups: php.notes 
Request: Send a blank email to php-notes+get-65853@lists.php.net to get a copy of this message
even simpler 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,''); $array[0] =& $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+40270 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40270&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40270&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65853) next »