首页 > Web开发 > 详细

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

时间:2016-02-05 21:06:41      阅读:223      评论:0      收藏:0      [点我收藏+]
复制代码 代码如下:

<?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 array_slice函数的使用以及参数详解

原文:http://www.jb51.net/article/15622.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!