PHP头条
热点:

phparray_slice函数的使用以及参数详解


代码如下:
/*
用手册上的例子
*/
$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这么远的距离

www.phpzy.comtrue/phpyy/12726.htmlTechArticlephparray_slice函数的使用以及参数详解 代码如下: /* 用手册上的例子 */ $input = array ("a", "b", "c", "d", "e"); $output = array_slice ($input, 2); // returns "c", "d", and "e", $output = array_slice ($input, 2, -1); // r...

相关文章

相关频道:

PHP之友评论

今天推荐