<meta name="viewport" content="width=device-width, initial-scale=1">

<?php
$folder = 'images/';
$files= array_diff(scandir($folder,SCANDIR_SORT_DESCENDING), array('..', '.'));
$arrlength=count($files);

for($x=0;$x<$arrlength;$x++)
  {
  echo "<div style='float:left; margin:2px; width:82px;'>
<a href='images/$files[$x]'><img src='images/$files[$x]' width=80 height=80 vspace=1 hspace=1 title='$files[$x]'></a>
<br></div>";
  };

echo "<br><br><br><br><br><br><br><br><br><br><br><br>";

echo "<pre>";
print_r($files);
echo "</pre>";
echo "$files[0]. $files[1]<br>";

?>






