开发者

return php array from certain index and on

开发者 https://www.devze.com 2023-03-22 04:20 出处:网络
What is a function to return an array containing only elements from a certain index on? so I have an array $array = (\'0\', \'1\', \'2\', \'3\', \'4\')

What is a function to return an array containing only elements from a certain index on?

so I have an array $array = ('0', '1', '2', '3', '4')

I want to return an array that looks like ('2', '3', '4')

开发者_StackOverflow社区How do I do that using index 2?

Thanks in advance


You can use array_slice:

$array = array('0', '1', '2', '3', '4');
print_r(array_slice($array,2));


Perhaps you would like to array_slice it?

0

精彩评论

暂无评论...
验证码 换一张
取 消