$PHP_SELF without the path?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Matt Phelps
Forum Commoner
Posts: 82
Joined: Fri Jun 14, 2002 2:05 pm

$PHP_SELF without the path?

Post by Matt Phelps »

Would appreciate some wisdom here!

I really want to get the name of my page/script and use that variable to define some other functions on the page. $PHP_SELF gives me this info but with the directory path appended to the front.

echo "$PHP_SELF" gives me 'images/page.php'...

...I want 'page.php'.

I can't explode the variable because the url is unpredicable and will give me different results depending on which piece of the exploded array I use.

Is there a similar function to $PHP_SELF that will give me just the script name and nothing else?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Post Reply