Write a PHP program to create a new array with n elements removed from the left
<?php function drop_from_left($items, $n = 1) { return array_slice($items, $n); } print_r(drop_from_left([1, 2, 3])); print_r(drop_from_left([1, 2, 3, 4], 2)); ?>
Sample Output:
Array ( [0] => 2 [1] => 3 ) Array ( [0] => 3 [1] => 4 )
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
Array ( [0] => 2 [1] => 3 ) Array ( [0] => 3 [1] => 4 )need an explanation for this answer? contact us directly to get an explanation for this answer