note 117751 added to function.array-slice
| From: | richardpq at gmail dot com | Date: | Sat, 01 Aug 2015 21:24:34 +0000 |
| Subject: | note 117751 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203242@lists.php.net to get a copy of this message | ||
@robert_johnson is incorrect, is not that php 5.5 preserver the keys is that the documentation is
very clear:
"...will reorder and reset the numeric array indices" so the key here is NUMERIC array
indices, therefor:
<?php
$test = array(
1=>'hello 1',
2=>'hello 2',
3=>'hello 3',
4=>'hello 4',
5=>'hello 5',
6=>'hello 6',
7=>'hello 7',
8=>'hello 8'
);
print_r( array_slice($test,2,5) );
?>
Will print:
Array
(
[0] => hello 3
[1] => hello 4
[2] => hello 5
[3] => hello 6
[4] => hello 7
)
----
Server IP: 72.52.91.14
Probable Submitter: 181.131.201.236
----
Manual Page -- http://php.net/manual/en/function.array-slice.php
Edit -- https://master.php.net/note/edit/117751
Del: integrated -- https://master.php.net/note/delete/117751/integrated
Del: useless -- https://master.php.net/note/delete/117751/useless
Del: bad code -- https://master.php.net/note/delete/117751/bad+code
Del: spam -- https://master.php.net/note/delete/117751/spam
Del: non-english -- https://master.php.net/note/delete/117751/non-english
Del: in docs -- https://master.php.net/note/delete/117751/in+docs
Del: other reasons-- https://master.php.net/note/delete/117751
Reject -- https://master.php.net/note/reject/117751
Search -- https://master.php.net/manage/user-notes.php