$file = \"refinish.php\";
$folder = rtrim($file, \".php\");
echo $folder; // refinis
where is ending h
?
I tried with some other
How rtrim() works
$file = "finish.php";
$folder = rtrim($file, ".php");
is processed working through the characters in $file from the last character backwards as
$file = "finish.php";
// ^
// Is there a `p` in the list of characters to trim
$folder = rtrim($file, ".php");
// ^
// Yes there is, so remove the `p` from the `$file` string
$file = "finish.ph";
// ^
// Is there a `h` in the list of characters to trim
$folder = rtrim($file, ".php");
// ^
// Yes there is, so remove the `h` from the `$file` string
$file = "finish.p";
// ^
// Is there a `p` in the list of characters to trim
$folder = rtrim($file, ".php");
// ^
// Yes there is, so remove the `p` from the `$file` string
$file = "finish.";
// ^
// Is there a `.` in the list of characters to trim
$folder = rtrim($file, ".php");
// ^
// Yes there is, so remove the `.` from the `$file` string
$file = "finish";
// ^
// Is there a `h` in the list of characters to trim
$folder = rtrim($file, ".php");
// ^
// Yes there is, so remove the `h` from the `$file` string
$file = "finis";
// ^
// Is there a `s` in the list of characters to trim
$folder = rtrim($file, ".php");
// ????
// No there isn't, so terminate the checks and return the current value of `$file`
$file = "finis";