note 107448 deleted from function.array-unshift by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 21:14:27 +0000 |
| Subject: | note 107448 deleted from function.array-unshift by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187859@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Whilst experimenting with the function Anonymous posted below I noticed there was a small error...
try this correction:
<?php
function array_unshift_assoc(&$arr, $key, $val)
{
$arr = array_reverse($arr, true);
$arr[$key] = $val;
$arr = array_reverse($arr, true);
return $arr;
}
?>