php get last node of array code example
Example 1: how to get last array element in php
<?php
$source_array = ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'];
$result = end($source_array);
echo "Last element: ".$result;
?>
Example 2: php last item of array
echo end(['Gon', 'Killua', 'Hisoka']) // print Hisoka