How to sort an array of items as numbers?
<p>I have a number of files I am loading into a slideshow, I have them numbered by the client in the order that they'd like to be displayed.</p>

<p>I'm grabbing them with glob <code>$pics = glob("images/slideshow/*.jpg", GLOB_NOSORT);</code> but for some reason I'm getting the old Windows sorting bug, of 11 being sorted above 2.</p>

<p>For example,</p>

<pre><code>Array
(
    [0] =&gt; images/slideshow/1.jpg
    [1] =&gt; images/slideshow/14.jpg
    [2] =&gt; images/slideshow/15.jpg
    [3] =&gt; images/slideshow/16.jpg
    [4] =&gt; images/slideshow/18.jpg
    [5] =&gt; images/slideshow/2.jpg
    [6] =&gt; images/slideshow/20.jpg
    [7] =&gt; images/slideshow/21.jpg
    [8] =&gt; images/slideshow/22.jpg
    [9] =&gt; images/slideshow/23.jpg
    [10] =&gt; images/slideshow/24a.jpg
    [11] =&gt; images/slideshow/25.jpg
    [12] =&gt; images/slideshow/26.jpg
    [13] =&gt; images/slideshow/29.jpg
    [14] =&gt; images/slideshow/3.jpg
    [15] =&gt; images/slideshow/36.jpg
    [16] =&gt; images/slideshow/38.jpg
    [17] =&gt; images/slideshow/4.jpg
    [18] =&gt; images/slideshow/40.jpg
    [19] =&gt; images/slideshow/41.jpg
    [20] =&gt; images/slideshow/5.jpg
    [21] =&gt; images/slideshow/6.jpg
    [22] =&gt; images/slideshow/7.jpg
)
</code></pre>

<p>I've run it through <code>asort()</code> and I can't seem to find out why this isn't working, short of it being something about them being strings, rather than strictly numbers.</p>
