Write a PHP program to get the last element of a given list
<?php function last($items) { return end($items); } print_r(last([1, 2, 3])); echo "\n"; print_r(last([2, 1, 3, -4, 5, 1, 2])); ?>
Sample Output:
3 2
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:
need an explanation for this answer? contact us directly to get an explanation for this answer