<?php
mix end ( arr &$array )
where,
$array = The given input ARRAY
?>
<?php
$arr01a =
[ "continents" => ["América do Sul", "Europa"],
"countries" => ["Brasil", "Chile", "Portugal", "España"] ];
echo 'The given ARRAY:<br>';
print_r($arr01a);
echo '<br><br>The last ELEMENT:<br>';
$lst01a = end($arr01a);
print_r($lst01a);
echo '<br><br>The last INDEX:<br>';
$key01a = key($arr01a);
print_r($key01a);
?>
<?php
$arr02b = [ "first index" => "FIRST ELEMENT",
"second index" => "SECOND ELEMENT",
"third index" => "THIRD ELEMENT",
"fourth index" => "FOURTH ELEMENT",
"fifth index" => "FIFITH ELEMENT",
"sixth index" => "SIXTH ELEMENT" ];
echo 'The given ARRAY:<br>';
print_r($arr02b);
echo '<br><br>The current INDEX:<br>';
$ndx02b = key($arr02b);
print_r($ndx02b);
echo '<br><br>The current ELEMENT:<br>';
$frs02b = current($arr02b);
print_r($frs02b);
echo '<br><br>';
$lst02b = end($arr02b);
echo '<br><br>The LAST INDEX:<br>';
$key02b = key($arr02b);
print_r($key02b);
echo '<br><br>The LAST ELEMENT:<br>';
print_r($lst02b);
?>