php get last index of array

42

<?php

$source_array = ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'];

$result = end($source_array);

echo "Last element: ".$result;

?>
$array = ['key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'];
$result = end($array);

Comments

Submit
0 Comments