/    Sign up×
Community /Pin to ProfileBookmark

quick predefined variable question

i know that $PHP_SELF gets the document file name, and the path. (eg. “/path/to/file.php”) – is there a pre defined variable to get [i]just[/i] the file name? or would i have to mess around with the string after geting $PHP_SELF ?

thanks

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@pyroDec 11.2003 — You'd just use [url=http://us4.php.net/basename]basename()[/url]. Also, I would not use register_globals. Use this: $_SERVER['PHP_SELF'] instead of $PHP_SELF.
Copy linkTweet thisAlerts:
@hammerslaneauthorDec 11.2003 — thanks for the tip

what's wrong with register_globals?

i'm not arguing, i'm just asking why it's best to put $_SERVER.

this command will be used on my company intranet... does the is it still best to use $_
SERVER?

many thanks
Copy linkTweet thisAlerts:
@pyroDec 11.2003 — You should not use register globals because of [url=http://us4.php.net/manual/en/security.registerglobals.php]security[/url] issues, and because they can be turned off in the php.ini file, and thus makes your code not portable.
×

Success!

Help @hammerslane spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...