note 95594 deleted from function.basename by danbrown
| From: | danbrown@php.net | Date: | Mon, 11 Jan 2010 14:46:27 +0000 |
| Subject: | note 95594 deleted from function.basename by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164854@lists.php.net to get a copy of this message | ||
Note Submitter: kingandy
----
@swedish boy - as of PHP 5.2.0, the filename (sans extension) is available directly in the result of
pathinfo(), so there's no need to involve basename() any more:
<?php
// your file
$file = 'image.jpg';
$info = pathinfo($file);
echo $info['filename']; // outputs 'image'
?>