title: PHP: Unlink All Files Within A Directory, and then Deleting That Directory
body: <p>I there a way I can use RegExp or Wildcard searches to quickly delete all files within a folder, and then remove that folder in PHP, WITHOUT using the "exec" command? My server does not give me authorization to use that command.  A simple loop of some kind would suffice.</p>
  
  <p>I need something that would accomplish the logic behind the following statement, but obviously, would be valid:</p>
  
  <pre>
  <code>
  $dir = "/home/dir"
  unlink($dir . "/*"); # "*" being a match for all strings
  rmdir($dir);
  </code>
  </pre>