Extract a portion of an array without modifying the original array using array_slice().
Source Code
$fruits = ['apple', 'banana', 'cherry', 'date', 'fig'];
$sliced = array_slice($fruits, 1, 3); // Starts at index 1 and extracts 3 elements
print_r($sliced); // Outputs: Array ( [0] => banana [1] => cherry [2] => date )