» Birthday Bundle - Over $400 worth of Envato files for just $20

PHP: Get filename of the currently executing script

Posted on May 21, 2008, Filled under PHP,  Bookmark it

Using this piece of code you will get the filename of the currently executing script without containing the full path to it.

For instance if $_SERVER['PHP_SELF'] is equal with /public_html/web/login.php our code will return only login.php

$self = basename($_SERVER['PHP_SELF']);

Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!

Get our RSS Feed!

Related Posts

Leave a Reply


* = required fields

  (will not be published)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: If you want to post CODE Snippets, please make them postable first!
(e.g. <br /> should be converted to &lt;br /&gt;)