I am trying to set the ID of the <body>
tag to be the name of the current page...
<body id="<?= basename($_SERVER['PHP_SELF'])?>">
Why is this returning:
<body id="wildlife.php">
?
I want just the word "wildlife."
I think you need to add the extension suffix to strip off, Try this
<body id="<?= basename($_SERVER['PHP_SELF'],'.php')?>">
You can do that:
if (preg_match('#([^/]+)\.\w+$#', 'http://www.mysite.com/home.php', $matches))
$basename = $matches[1];
Try it this way :
basename($PHP_SELF,".php");