How Do I find the name of the page title from $_SERVER['php_self']
?
Let's say the $_SERVER
shows my page like this: /application/mysite/signup.php
.
How can I select the page title signup
?
You can use basename
:
echo basename($_SERVER['php_self'], '.php');
or pathinfo
:
$pathInfo = pathinfo($_SERVER['php_self']);
echo $pathInfo['filename'];