<?php
$a=array("red","green","blue","yellow","brown");
print_r(array_slice($a,1,2));
?>
从数组的第二个元素开始取出,并仅返回两个元素
<?php
$a=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow","e"=>"brown");
print_r(array_slice($a,1,2));
$a=array("0"=>"red","1"=>"green","2"=>"blue","3"=>"yellow","4"=>"brown");
print_r(array_slice($a,1,2));
?>
带有字符串和整数键名
以上就是网页知识大全为大家推荐的PHP array_slice() 函数教程
版权声明:本站内容为网页知识大全所有,严禁复制,转载,其他部份为用户投稿,如有侵权请速告知,我们将会在24小时内删除;