note 42685 added to function.strrpos

From: Date: Wed, 26 May 2004 13:22:09 +0000
Subject: note 42685 added to function.strrpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-70108@lists.php.net to get a copy of this message
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; } ---- Manual Page -- http://www.php.net/manual/en/function.strrpos.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42685 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42685&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42685&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#70108) next »