note 117710 added to function.array-slice
| From: | kezzyhko at gmail dot com | Date: | Mon, 27 Jul 2015 06:48:11 +0000 |
| Subject: | note 117710 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203190@lists.php.net to get a copy of this message | ||
( If $offset is negative and abs($length)>count($length) ) or ( $offset>count($array) ) etc,
array_slice returns empty array. For example:
<?php
$array = array(
'a'=>'1',
'b'=>'2',
'c'=>'3',
'd'=>'4',
'e'=>'5',
'f'=>'6',
'g'=>'7',
'h'=>'8'
);
print_r( array_slice($test, 2, -10) );
print_r( array_slice($test, 10, 1) );
print_r( array_slice($test, 10, 15) );
//prints
//Array()
//Array()
//Array()
?>
----
Server IP: 72.52.91.14
Probable Submitter: 89.222.164.46
----
Manual Page -- http://php.net/manual/en/function.array-slice.php
Edit -- https://master.php.net/note/edit/117710
Del: integrated -- https://master.php.net/note/delete/117710/integrated
Del: useless -- https://master.php.net/note/delete/117710/useless
Del: bad code -- https://master.php.net/note/delete/117710/bad+code
Del: spam -- https://master.php.net/note/delete/117710/spam
Del: non-english -- https://master.php.net/note/delete/117710/non-english
Del: in docs -- https://master.php.net/note/delete/117710/in+docs
Del: other reasons-- https://master.php.net/note/delete/117710
Reject -- https://master.php.net/note/reject/117710
Search -- https://master.php.net/manage/user-notes.php