Reputation: 177
I need to choose some folders to turn them into an array and count the inside of it, to dynamically display the amount of images in it.
Right now i have a path variable:
$gallery_path = "assets/images/content/referenzen/gallery";
From there i count all images inside a specific folder inside the $gallery_path, like so:
$refA_path = "assets/images/content/referenzen/gallery/refA";
$refA = glob($refA_path . '/*.{jpeg,jpg,png}', GLOB_BRACE);
echo count($refA);
I have different folders which are named like refA, refAb and so forth. What i want to do is to choose only folders with a name of ref{number or letter}. Something like:
$refA_path = "assets/images/content/referenzen/gallery/{all folders with ref*}";
Is there anything like it in regex to achieve this?
Upvotes: 0
Views: 48
Reputation: 2229
You could use glob()
aswell, with GLOB_ONLYDIR option.
$paths_array = glob("assets/images/content/referenzen/gallery/ref*", GLOB_ONLYDIR);
Upvotes: 2