note 41281 deleted from function.array-slice by cmb
| From: | cmb@php.net | Date: | Sun, 29 Dec 2019 12:31:47 +0000 |
| Subject: | note 41281 deleted from function.array-slice by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213708@lists.php.net to get a copy of this message | ||
Note Submitter: Samuele at norsam dot org
----
Note that if $offset+$length>count($array) then resulting array will NOT be filled with empty
elements at his end, so it is not sure that it will have exactly $length elements. Example:
<?php
$a=Array(7,32,11,24,65); // count($a) is 5
$b=array_slice($a,2,4); // 2+4=6, and 6>count($a)
print_r($b);
?>
will return a 3-elements array:
Array
(
[0] => 11
[1] => 24
[2] => 65
)