note 36604 added to function.basename
| From: | daijoubu_NOSP at M_videotron dot ca | Date: | Thu, 16 Oct 2003 02:22:13 +0000 |
| Subject: | note 36604 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58672@lists.php.net to get a copy of this message | ||
An faster alternative to:
<?php
array_pop(explode('.', $fpath));
?>
would be:
<?php
substr($fpath, strrpos($fpath, '.')); // returns the dot
?>
If you don't want the dot, simply adds 1 to the position
<?php
substr($fpath, strrpos($fpath, '.') + 1); // returns the ext only
?>
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36604
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36604&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36604&report=yes
Search -- http://master.php.net/manage/user-notes.php