I'm attempting to implement this code into Wordpress:

<?php
    $basename = substr(strtolower(basename($_SERVER['PHP_SELF'])),0,strlen(basename($_SERVER['PHP_SELF']))-4);
?>

Regardless of by which from the Wordpress php files I put this in, it corrupts it. Stating that it can't discover the page. This is bizarre. Do anybody know why it's acting such as this? Or any direct methods to the way i can also add this code to Wordpress?

Note that i'm not familiar with PHP so any respond with detail could be appreciated.

The reply is:

$basename = strtolower( substr(basename($_SERVER['PHP_SELF']),0,-4));

You are over-further complicating what you are attempting to do.

$fileName = strtolower(basename(__FILE__, ".php"));

You might want to use php_self rather than file, it is dependent on which you are after.

This can be a parse error.

You'll need a closing bracket in the finish:

  $basename = substr(strtolower(basename($_SERVER['PHP_SELF'])),0,strlen(basename($_SERVER['PHP_SELF']))-4)

It is a positive thing to utilize a text editor or IDE with syntax highlighting that may reveal may be, they're frequently hard to see using the human eye alone.

Nevertheless, as @JMC Creative highlights, this looks very kludgy, and there's certain to be an easy method to attain what you would like. What's the goal of the?