Search for highest key/index in an array
You can get the maximum key this way:
<?php
$arr = array("a"=>"test", "b"=>"ztest");
$max = max(array_keys($arr));
?>
This should work fine
$arr = array( 1 => "A", 10 => "B", 5 => "C" );
max(array_keys($arr));