get last index of a needle php array code example
Example: php index of last element in array
<?php
$source_array = [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3'
];
echo "Last index: " . array_key_last($source_array);
?>
<?php
$source_array = [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3'
];
echo "Last index: " . array_key_last($source_array);
?>