PHP: Find highest index of numeric array that has missing elements : <p>Say I have the following array:</p>

<pre><code>$n[5] = "hello";
$n[10]= "goodbye";`
</code></pre>

<p>I would like to find out the highest index of this array.
In Javascript, I could do <code>$n.length - 1</code> which would return <code>10</code>.
In PHP, though, <code>count($n)</code> returns 2, which is the number of elements in the array.</p>

<p>So how to get the highest index of the array?</p>
