note 76455 added to function.array-slice
| From: | phpnotasp at gmail dot com | Date: | Mon, 16 Jul 2007 21:42:14 +0000 |
| Subject: | note 76455 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128632@lists.php.net to get a copy of this message | ||
It should be noted that this function does NOT modify the original array. So if you need to
array_pop() or array_shift() without modifying the original array, you can use array_slice().
<?php
$input = array('a', 'b', 'c');
$output = array_slice($input, 1);
print_r($output);
print_r($input);
/*
Array
(
[0] => b
[1] => c
)
Array
(
[0] => a
[1] => b
[2] => c
)
*/
?>
----
Server IP: 64.71.164.2
Probable Submitter: 72.48.97.42
----
Manual Page -- http://www.php.net/manual/en/function.array-slice.php
Edit -- https://master.php.net/note/edit/76455
Del: integrated -- https://master.php.net/note/delete/76455/integrated
Del: useless -- https://master.php.net/note/delete/76455/useless
Del: bad code -- https://master.php.net/note/delete/76455/bad+code
Del: spam -- https://master.php.net/note/delete/76455/spam
Del: non-english -- https://master.php.net/note/delete/76455/non-english
Del: in docs -- https://master.php.net/note/delete/76455/in+docs
Del: other reasons-- https://master.php.net/note/delete/76455
Reject -- https://master.php.net/note/reject/76455
Search -- https://master.php.net/manage/user-notes.php