title: php get file folder name from url
body: <p>I need get  file folder name from url</p>
  
  <pre><code> examples: 
   http://domain/folder/NEEDTHIS/filename.xml
   http://domain/folder/folder2/NEEDTHIS/filename.xml
   http://domain/folder/folder2/folderanother/NEEDTHIS/filename.xml
  </code></pre>
  
  <p>I need only "NEEDTHIS" folder name only
  i using this code for get file name</p>
  
  <pre><code> $parts = parse_url("http://domain/folder/NEEDTHIS/filename.xml");  
              $title = basename($parts['path']);  
  echo $title;
  // Output: filename.xml
  </code></pre>
  
  <p>How can i get this file name folder?</p>