note 89105 deleted from function.basename by danbrown
| From: | danbrown@php.net | Date: | Sun, 22 Feb 2009 00:25:34 +0000 |
| Subject: | note 89105 deleted from function.basename by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150936@lists.php.net to get a copy of this message | ||
Note Submitter: devrim at payms dot com
----
$url = "http://www.d.com/1/2/name.phdp?id=asdf&asdf&jo.com";
$uA = explode("?",$url);
$uA2 = explode("/",$uA[0]);
$fn = $uA2[count($uA2)-1];
echo $fn;
this is the filename of the whole url. strip the part after ? first, and get the last part after
last /.
if there is no ? result remains the same.