note 37107 added to function.array-splice
| From: | roeltje dot com at rn2 dot php dot net | Date: | Mon, 03 Nov 2003 16:56:17 +0000 |
| Subject: | note 37107 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59724@lists.php.net to get a copy of this message | ||
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...
----
Manual Page -- http://www.php.net/manual/en/function.array-splice.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37107
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37107&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37107&report=yes
Search -- http://master.php.net/manage/user-notes.php