i used this code to Search directory

PHP Code:
<?php
if ($handle opendir('./')) {
while (
false !== ($file readdir($handle))) {
    
$filesplit explode("."$file);
    
$check $filesplit[0];
$keyword=$_GET['search'];
if(
ereg($keyword$check))
      {
         
$check .= ".$filesplit[1]";
         
$valid[] = $check;
      }
}
for(
$index 0$index count($valid); $index++)
{
  echo
"<br>$valid[$index]";
}
closedir($handle);
 
 }
?>
but it only search the main directory, not the Subdirectories.... can someone please customize it so that Subdirectories also be searched too...