PHP: Remove filename from URL

/*
 Removes the file name from a link
 for example http://www.ekiwi.de/content/link.php
 will return http://www.ekiwi.de/content/
*/
function removeFileNameFromUrl($url) {
 $len = strlen($url);

 for ($i = $len; $i > 0; $i–) {
  if ($url[$i] == "/") {
   $url = substr($url, 0, $i + 1);
   return $url;  
  }
 }
}


Datenschutzerklärung | Impressum