note 117711 added to function.array-slice

From: Date: Mon, 27 Jul 2015 06:49:19 +0000
Subject: note 117711 added to function.array-slice
Groups: php.notes 
Request: Send a blank email to php-notes+get-203191@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/117711 Del: integrated -- https://master.php.net/note/delete/117711/integrated Del: useless -- https://master.php.net/note/delete/117711/useless Del: bad code -- https://master.php.net/note/delete/117711/bad+code Del: spam -- https://master.php.net/note/delete/117711/spam Del: non-english -- https://master.php.net/note/delete/117711/non-english Del: in docs -- https://master.php.net/note/delete/117711/in+docs Del: other reasons-- https://master.php.net/note/delete/117711 Reject -- https://master.php.net/note/reject/117711 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203191) next »