note 37107 deleted from function.array-splice by felipe
| From: | felipe@php.net | Date: | Sat, 05 Jan 2008 02:08:22 +0000 |
| Subject: | note 37107 deleted from function.array-splice by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134815@lists.php.net to get a copy of this message | ||
Note Submitter: roeltje.com
----
In reply on the message "18-Aug-2003 09:57"
If you want to insert a value into some array
<?
// I think we can replace
array_splice($array, 3, count($array), array_merge(array('x'), array_slice($array, 3)));
// with for inserting multiple values
array_splice($array, 3, 0, array('x','y'));
// or for just inserting 1 value
array_splice($array, 3, 0, 'x');
?>
Sounds to me a lot faster.
Roeltje...