note 104203 deleted from function.basename by danbrown
| From: | danbrown@php.net | Date: | Tue, 31 May 2011 20:28:15 +0000 |
| Subject: | note 104203 deleted from function.basename by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180144@lists.php.net to get a copy of this message | ||
Note Submitter: jhonatan dot teixeira at gmail dot com
----
$info = pathinfo($file);
$file_name = basename($file,'.'.$info['extension']);
why would you use the basename if u already used pathinfo?
the pathinfo function also returns the basename for you and also filename that is the filename
without the extension
well... since php 5.2.0.... anyway if ur using php above 5.2.0 u can use the filename index from the
pathinfo return array
i usualy do this:
$fileInfo = (object) pathinfo($filename);