title: How to get the newest file in a directory in php
body: <p>So I have this app that processes CSV files. I have a line of code to load the file.</p>
  
  <pre><code>$myFile = "data/FrontlineSMS_Message_Export_20120721.csv";  //The name of the CSV file
  $fh = fopen($myFile, 'r');                             //Open the file
  </code></pre>
  
  <p>I would like to find a way in which I could look in the <code>data</code> directory and get the newest file (they all have date tags so they would be in order inside of <code>data</code>) and set the name equal to <code>$myFile</code>.</p>
  
  <p>I really couldn't find and understand the documentation of php directories so any helpful resources would be appreciated as well. Thank you.</p>