Deletion and filling of array elements array_slice
多吃水果,多喝水
多吃水果,多喝水 2018-11-01 21:57:23
0
1
1217

<?php

    $arr=[10,20,30,40,50,60]

echo var_export(array_slice($arr,offset :2,length:-2)

The -2 here is to delete the last two elements of the return value. Why can't the length be written directly as 2? Is there a difference between the two?

多吃水果,多喝水
多吃水果,多喝水

reply all(1)
Summer

length

Optional. numerical value. Specifies the length of the returned array.

If the value is set to an integer, this number of elements is returned.

If this value is set to a negative number, the function will terminate fetching this far from the end of the example array.

If this value is not set, all elements starting from the position set by the start parameter to the end of the array are returned.


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template