note 42686 deleted from function.strrpos by nlopess

From: Date: Wed, 26 May 2004 13:28:35 +0000
Subject: note 42686 deleted from function.strrpos by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70113@lists.php.net to get a copy of this message
Note Submitter: harlequin2 AT gmx DOT de ---- I think this could be helpful too: Get a filename from a url: function getfname($url){ $pos = strrpos($url, "/"); if ($pos === false) { // not found / no filename in url... return false; } else { // Get the string length $len = strlen($url); if ($len >= $pos){ // the last slash we found belongs to http:// or it is the trailing slash of a URL return false; } else { $filename = substr($url, $pos+1, $len-$pos-1); } } return $filename; }

« previous php.notes (#70113) next »