I'm using the following code to search for all the images in all the subfolders of a directory:
function get_images10($root) {
$r = array();
foreach(glob("$root/*") as $n) {
if (is_dir($n)) {
$r = array_merge($r, get_images10($n));
} else {
$r[] = $n;
}
}
return $r;
}
It works fine, but now I would like to limit the search only to the images that contain in their filename the suffix "thumb-". In another script I have used the following:
if ((strpos($filename,'thumb-') !== false)) {
//some code
}
But I have no idea where to put such statement (if) in the above mentioned code. Any idea on how I could do that?