I want to remove \".php\" from the end of a string if it exists. Consider this:
$filename = \'index\'; rtrim($filename,\".php\");//returns \"index\" $filena
if you're simply trying to remove the extension, why not use this: $filename = 'index.php'; $name = strstr($filename, '.', true);