note 99454 deleted from function.basename by danbrown
| From: | danbrown@php.net | Date: | Wed, 18 Aug 2010 15:45:47 +0000 |
| Subject: | note 99454 deleted from function.basename by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171804@lists.php.net to get a copy of this message | ||
Note Submitter: markandrewslade at gmail dot com
----
Quick way to get "foobar" out of "foobar.txt":
<?php
$file = 'foobar.txt';
echo basename($file, strrchr($file, '.')) . "\n";
$path = '/path/to/foobar.txt';
echo basename(basename($path), strrchr($path, '.')) . "\n";
// Output:
// foobar
// foobar
?>