Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

$PHP_SELF non printable character before extension

I noticed that in some situations $PHP_SELF was returning a non printable character before the extension, so filename.php might become filename non printable character php.

The culprit turned out to be:

$pagename = $PHP_SELF;
$pagename = basename($pagename,".php");

Which inexplicably needed to be changed to:

$pagename = $_SERVER['$PHP_SELF'];
$pagename = basename($pagename,".php");

Afterwhich the code produced the expected output.

Share this!