faqts : Computers : Programming : Languages : PHP : Common Problems : Variables

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 5 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

In my pageheader I call $category = "vari"; Where vari should be the filename minus .php3. How can this be done?

Mar 26th, 2001 21:47
Ben Udall, Peter van Beelen,


You can usually find the filename in the variable $PHP_SELF.  From 
there, a regular expression can be used to grab to everything before 
the file extension.
$category = ereg_replace("\\.[^.]+$", "", $PHP_SELF);