Php Array Elements Slice Function
What is array_slice Function?
Explanation
The "array_slice" function is used to slice 0r extract elements from the array
Syntax:
array_slice(array,start,length,preserve)
In the above syntax "array" specifies the array,"start" specifes where the function will start to splice, "length" specifes the total length of the slice, "preserve" if "true" else it will reset keys.
Example :
<?php
$b=array( 0 =>"Cherry",1 =>"Strawberry", 2 =>"Apple", 3 => "Orange");
print_r(array_slice($b,1,2));
?>
Result :
Array ( [1]=> Strawberry, [2]= Apple);
In the above example the array is sliced from the first element to length of second elements length totally.