【发布时间】:2013-05-17 23:41:37
【问题描述】:
PHP 函数 array_slice() 按偏移量返回元素序列,如下所示:
// sample data
$a = array('a','b','c',100=>'aa',101=>'bb',102=>'cc');
// outputs empty array because offset 100 not defined
print_r(array_slice($a,100));
当前函数参数:
array_slice ( $array, $offset, $length, $preserve_keys)
我需要这样的东西:
array_slice ( $array, **$key**, $length, $preserve_keys)
根据上面的print_r输出这个:
array (
100 => aa,
101 => bb,
102 => cc
)
【问题讨论】:
标签: php arrays slice offset array-filter