PHP 8.4.24 Released!

Voting

: min(two, two)?
(Example: nine)

The Note You're Voting On

iamnotanerd
21 years ago
Here is a snippet of the code that I created to search for a file..recursively open the directories and search for a match..

<?php
function search($target, $directory){
     
    if(is_dir($directory)){
        $direc = opendir($directory);
        while(false !== ($file = readdir($direc))){
            
            if($file !="." && $file != ".."){

                if(is_file($directory."/".$file)){
                    if(preg_match("/$target/i", $file)){
                                            echo "<a href=\"$directory/$file\">$file</a><br>";
                                        }
                }else if(is_dir($directory."/".$file)){
                    search($target,$directory."/".$file);
                    
                }

            }
        }
        closedir($direc);
    }

    return ;
}
?>

<< Back to user notes page

To Top