Re: getting $PHP_SELF's basename
| From: | Lars Torben Wilson | Date: | Tue, 12 Feb 2002 21:26:12 +0000 |
| Subject: | Re: getting $PHP_SELF's basename | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84463@lists.php.net to get a copy of this message | ||
On Tue, 2002-02-12 at 13:16, Erik Price wrote:
> Is there already a built-in function that gets the basename of the
> current file?
>
> I wrote this:
>
> function get_current_page_name()
> {
> $current_page_name = explode("/", $_SERVER['PHP_SELF']);
> $current_page_name = array_slice($current_page_name, -1);
> return $current_page_name;
> }
>
> but I'm wondering if someone already did it for me.
>
>
>
> Erik
echo basename($_SERVER['PHP_SELF']);
http://www.php.net/basename
Hope this helps,
Torben
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506