note 27931 added to function.substr

From: Date: Thu, 26 Dec 2002 00:27:19 +0000
Subject: note 27931 added to function.substr
Groups: php.notes 
Request: Send a blank email to php-notes+get-41289@lists.php.net to get a copy of this message
/******************************************** Getting the file name from an address like http://www.xpto12345.xyz/abc/def/ghi.php using substr() function ********************************************/ // This procedure only works when the filename // is at the end of the string $fn="abc/def/ghi/jkl.php"; // 'where is the filename' string $a = strlen("$fn"); while ($a>0){ if(substr(substr($fn, $a, strlen($fn)), 0, 1)=="/"){break;} $b=substr($fn, $a, strlen($fn)); $a=$a-1; } print $b; -- http://www.php.net/manual/en/function.substr.php http://master.php.net/manage/user-notes.php?action=edit+27931 http://master.php.net/manage/user-notes.php?action=delete+27931 http://master.php.net/manage/user-notes.php?action=reject+27931

« previous php.notes (#41289) next »