If you have a website written in php and you want to get the name of the current page, it is actually very easy.
basename(preg_replace('/\.php$/', , __FILE__))
Let´s brake this down:
gives you the name of the current file including .php and the full path.
To get rid of the extension we use
(preg_replace('/\.php$/', , __FILE__)
which replaces the .php with nothing.
Now, to get rid of the full path, we use the php function basename.
If you - for example - want to replace the keywords meta tag with the name of the current page you can insert the following into your head section:
<meta name="keywords" content="<?php echo basename(preg_replace('/\.php$/', , __FILE__)) ?>" />
This is great if you want to create dynamically created sites.