What is the fastest and easiest way to get the last item of an array whether be indexed array , associative array or multi-dimensional array?
Advertisement
Answer
$myArray = array( 5, 4, 3, 2, 1 ); echo end($myArray);
prints “1”
What is the fastest and easiest way to get the last item of an array whether be indexed array , associative array or multi-dimensional array?
$myArray = array( 5, 4, 3, 2, 1 ); echo end($myArray);
prints “1”