Jump to content

Display Directory Contents


Cetanu

Recommended Posts

<?php

<?php
$images = array_merge(glob("*.gif"),glob("*.jpg"),glob("*.png"));//create giant array of all images in a directory using glob
foreach ($images as $filename) {
    echo "<img src='$filename' /><br>"."\n";
}

?>

 

Just off the top of my head, I dun think you could use glob to select multiple file types as if it was regex:

 

glob("*.(jpg|gif|png)");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.