<p>I'm using this script to display all the images in a folder, but I can't figure out how to get each image's file name to display underneath it. Any suggestions?</p>

<pre><code>&lt;?php

$dirname = "images";
$images = scandir($dirname);
$ignore = Array(".", "..", "otherfiletoignore");

foreach($images as $curimg){
    if (!in_array($curimg, $ignore)) {
        echo "&lt;img src='images/$curimg' /&gt;&lt;br /&gt;\n";
    }
} 
?&gt;
</code></pre>

```
```
echo "<img src='images/$curimg' /><br />$curimg<br />\n";
```
```