PHP array_slice() 函数代码如下:
<?php
$a=array("red","green","blue","yellow","brown");
print_r(array_slice($a,1,2));
?>
PHP array_slice() 函数 实例
从数组的第二个元素开始取出,并仅返回两个元素
<?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() 函数 实例
带有字符串和整数键名
以上就是网页知识大全为大家推荐的PHP array_slice() 函数教程
读完这篇文章后,您心情如何?