Sorting Glob results in reverse order and limiting to 2
<p>I'm trying to make a list of files inside a folder but in reverse order and limiting to 2 (the last 2), there are a lot of good examples so I liked this one... but I'm trying to limit the amount of results, I almost have it but it gives me an error... can you guys help me?</p>

<pre><code>&lt;?php
foreach (glob("../../imagenes/medianas/*") as $files) {
$images[filectime($files)] = $files;
}
krsort($images);
foreach($images as $timestamp =&gt; $files) if ($limite++ &lt; 2){

print "&lt;img src='../../imagenes/medianas/". basename($files) ."' title=''&gt;"."&lt;br&gt;";
}
?&gt;
</code></pre>

<p>Thanks' a bunch for your help.</p>

<hr>

<p>Sorry all, OK... I Fixed it, this is how it works... Thanks Jon, nice hint.
Here is the code for anyone who has the same issue</p>

<pre><code>&lt;?php
$limite = 0;
foreach (glob("../../imagenes/medianas/*") as $files) {
    $images[filectime($files)] = $files;
}
krsort($images);
foreach($images as $timestamp =&gt; $files) if ($limite++ &lt; 2){

   print "&lt;img src='../../imagenes/medianas/". basename($files) ."' title=''&gt;"."&lt;br&gt;";
}
?&gt;
</code></pre>
