php array_slice函数的使用以及参数详解
php array_slice函数的使用以及参数详解
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:重点说下length为负.它表示取数组一直到距离数组末端length这么远的距离

复制代码 代码如下:

<?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这么远的距离

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新php教程学习
热门php教程学习
编程开发子分类