网络编程 
首页 > 网络编程 > 浏览文章

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

(编辑:jimmy 日期: 2024/9/25 浏览:3 次 )
复制代码 代码如下:
<?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生成HTML静态页面实例代码
下一篇:PHP中常用数组处理方法实例分析
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 SiteMap