Say I have the following array:
$n[5] = "hello";
$n[10]= "goodbye";`
I would like to find out the highest index of this array.
In Javascript, I could do $n.length - 1
which would return 10
.
In PHP, though, count($n)
returns 2, which is the number of elements in the array.
So how to get the highest index of the array?