note 30872 deleted from function.basename by googleguy
| From: | googleguy@php.net | Date: | Sat, 12 Jan 2013 09:48:38 +0000 |
| Subject: | note 30872 deleted from function.basename by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192967@lists.php.net to get a copy of this message | ||
Note Submitter: Richard at Lyders dot Net
----
you can also make use of the basename() function's second parameter:
<?PHP
$fpath = "/blah/file.name.has.lots.of.dots.ext";
$fext = array_pop(explode('.', $fpath));
$fname = basename($fpath, '.'.$fext);
print "fpath: $fpath\n<br>";
print "fext: $fext\n<br>";
print "fname: $fname\n<br>";
?>