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?
<?php
foreach (glob("../../imagenes/medianas/*") as $files) {
$images[filectime($files)] = $files;
}
krsort($images);
foreach($images as $timestamp => $files) if ($limite++ < 2){
print "<img src='../../imagenes/medianas/". basename($files) ."' title=''>"."<br>";
}
?>
Thanks' a bunch for your help.
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
<?php
$limite = 0;
foreach (glob("../../imagenes/medianas/*") as $files) {
$images[filectime($files)] = $files;
}
krsort($images);
foreach($images as $timestamp => $files) if ($limite++ < 2){
print "<img src='../../imagenes/medianas/". basename($files) ."' title=''>"."<br>";
}
?>