title: PHP Get File By Regexp
body: <p>Is there a way that I can have PHP get a file by a Regexp search? I know how to open and read a directory no problem, but finding a particular file <em>is</em> the problem.</p>
  
  <p>Here is an example, I have a logo which may end in any of the following extensions: <code>.bmp</code>, <code>.png</code>, <code>.jpg</code>, <code>.jpeg</code>, or <code>.gif</code>. However, the name of the file will <em>always</em> be <code>icon.someext</code>.</p>
  
  <pre><code>$filesDirectory = scandir("/files");
  
  foreach($filesDirectory as $file) {
      [Regexp find logo here] ? $logo = $file : null;
  }
  
  echo $logo; // Returns something like logo.png
  </code></pre>
  
  <p>Thank you for your time.</p>