note 105973 modified in function.array-splice by salathe
| From: | salathe@php.net | Date: | Thu, 29 Sep 2011 12:51:25 +0000 |
| Subject: | note 105973 modified in function.array-splice by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183523@lists.php.net to get a copy of this message | ||
Interestingly -0 offset also works !
<?php
$input = array("red", "green", "blue",
"yellow","marron","cyban");
$a=array_splice($input, -0,3);
print_r($a);
//$a prints to Array([0] => red,[1] => green,[2] => blue)
?>
--was--
/*Interestingly -0 offset also works !*/
$input = array("red", "green", "blue",
"yellow","marron","cyban");
$a=array_splice($input, -0,3);
print_r($a);
//$a prints to Array([0] => red,[1] => green,[2] => blue)
http://php.net/manual/en/function.array-splice.php