What is the PHP function equivalent to array[3..8] in Perl, to get a specific range of values from an array?

To get a specific range of values from an array in PHP, you can use the array_slice() function. This function allows you to extract a portion of an array based on the specified start and length parameters. By providing the array, the starting index, and the length of the desired range, you can achieve the equivalent functionality of array[3..8] in Perl.

// Define an array
$array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

// Get values from index 3 to 8
$range = array_slice($array, 3, 6);

// Output the range
print_r($range);