$file = \"refinish.php\"; $folder = rtrim($file, \".php\"); echo $folder; // refinis
where is ending h ?
h
I tried with some other
rtrim's second argument is not the substring to remove but a set of characters—could also be a range. You can use preg_replace if you want to make sure only the trailing .php is removed. e.g.,
rtrim
preg_replace
.php
preg_replace("/\.php$/", "", "refinish.php")