How can I get a listing of all images having specific extension from multiple folders using the PHP glob() function?
$images = glob("data/{'./assets/img/post/birthday-wishes/*.png','./assets/img/post/birthday-quotes/*.png'}/*", GLOB_BRACE);
echo $images;
CodePudding user response:
Try this code if helpful
$images = glob("data/{assets/img/post/birthday-wishes/*.png,assets/img/post/birthday-quotes/*.png}", GLOB_BRACE);
echo $images;
CodePudding user response:
Use multiple asterisks with the glob() function
$images = glob('./assets/img/post/*/*.png');
print_r($images);
