I'm serching files in a directory

**PROBLEM**

I need to retrieve files whose directory matches with the word entered

I need something like: `glob (gifs/[like $varSearched]/*.gif)`

**Directory**

```
 gifs/hello/1.gif
 gifs/hello/2.gif
 gifs/hello/3.gif

 gifs/claps/1.gif
 gifs/claps/2.gif

 gifs/wow/1.gif
 gifs/wow/2.gif

```

**PATH PHP** (it works but its needed to type all the file directory "hello", "wow", "claps" to retrieve the results). What I need is to type one or two letter only to retrieve the results

```
$dir="o"; // "o" is the searched term
$mdir = "../gifs/".$dir."/";
$files = glob($mdir.'*.gif');
foreach ($files as $gif){
$title = basename(dirname($gif));

$arr[] =  $title." - ".$gif;

}
$arr= implode("",$arr);
echo $arr;

```

**EXPECTED RESULTS**

```
 gifs/hello/1.gif
 gifs/hello/2.gif
 gifs/hello/3.gif
 gifs/wow/1.gif
 gifs/wow/2.gif

```