Search for files dynamically in php
<p><img src="http://i.stack.imgur.com/RWpDl.png" alt="enter image description here"></p>

<p>I basically want to search for a file on my computer. I know how to search but is there a fast way of searching a name and an extension without flooding my script with more than 2 for loops? the names (eg.. file,virus,node,misc) and the extensions will be added dynamically, Not through the source code.. the names will be in the thousands so i dont want to add them one by one, hence why i am doing it dynamically.</p>

<p>i was thinking:</p>

<pre><code>foreach($names as $i){
  if (file_exists($i.".exe" | $i.".py" | $i.".js" | $i.".html" | )){
    //echo true or false}}
</code></pre>

<p>Like i said. I will be adding in extensions dynamically also. Would it be worth it having the code long with <code>file_exists(20 thousand extensions)</code> or just add them with a form?</p>

<p>Would it be a for loop inside another for loop?</p>
