title: Check if directory path ends with DIRECTORY_SEPARATOR
body: <p>In PHP I'm receiving a string from the user for a local file directory <code>$path</code></p>
  
  <p>I want to know if they've included the trailing slash (/) or not. I would like this to be cross platform so I'd like to use the PHP constant <code>DIRECTORY_SEPARATOR</code></p>
  
  <p>My failed attempts include trying to do a preg_match like </p>
  
  <pre><code>preg_match("/" . DIRECTORY_SEPARATOR . "$/", $path);
  </code></pre>
  
  <p>I basically just want an elegant way to test if the string ends with the <code>DIRECTORY_SEPARATOR</code>.</p>