note 41281 added to function.array-slice
| From: | Samueleatnorsamdotorg at rn2 dot php dot net | Date: | Mon, 05 Apr 2004 13:44:26 +0000 |
| Subject: | note 41281 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67656@lists.php.net to get a copy of this message | ||
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
)
----
Manual Page -- http://www.php.net/manual/en/function.array-slice.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41281
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41281&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41281&report=yes
Search -- http://master.php.net/manage/user-notes.php