您的位置:首页 > 编程语言 > PHP开发

php array_slice函数的使用以及参数详解

2008-08-30 00:00 801 查看
<?php 
/* 
用手册上的例子 
*/ 
$input = array ("a", "b", "c", "d", "e"); 
$output = array_slice ($input, 2); // returns "c", "d", and "e", 
$output = array_slice ($input, 2, -1); // returns "c", "d" 
$output = array_slice ($input, -2, 1); // returns "d" 
$output = array_slice ($input, 0, 3); // returns "a", "b", and "c" 
?>

重点说下length 为负.它表示取数组一直到距离数组末端length这么远的距离
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: