How to make a function find a file through multiple directories?
<p>Is there a "performant" way in PHP to search for a file through multiple directories?</p>

<p>Lets say I know that the file may be in one of the search paths:</p>

<p>$pathOne, $pathTwo, $pathThree. But now lets imagine, the user (developer who uses the framework) is able to group his stuff in subfolders as well. $pathTwo contains 20 subfolders, and each subfolder contains 2 more subfolders. </p>

<p>How could I search across all these paths plus subfolders for a $file? I've seen some frameworks using the file_exists() function excessively to do something like that (but without searching down the subfolders). Probably I would need a way to figure out which folders are there, and then step into them?</p>
