create a new array with n elements removed from the left in PHP

PHP
4
$arr = array(1, 2, 3, 4, 5);
$n = 2;
$new_arr = array_slice($arr, $n);
print_r($new_arr);
🤖 Code Explanation
This code will take the array $arr and return a new array that contains all the elements of $arr starting from the element at index $n.

More problems solved in PHP




















