title: Trying to cut off the file portion of a URI/URL
body: <p>I'm trying to cut the last portion of a URI as such:</p>
  
  <pre><code>public://path1/path2/path3/filename.extension
  </code></pre>
  
  <p>Ultimately I just want <code>public://path1/path2/path3/</code> or <code>public://path1/path2/path3</code></p>
  
  <p>I've tried using explode, but that seems to have some trouble with :// part of the URL. I'm trying to see if there's a way to do it with substr and strpos.</p>
  
  <p>Any ideas?</p>
  
  <p>Oh, I wasn't clear, I meant PHP.</p>