rtrim function doesn't work with ending h letter

前端 未结 5 824
感动是毒
感动是毒 2021-01-26 04:26
$file = \"refinish.php\";
$folder = rtrim($file, \".php\");
echo $folder; // refinis

where is ending h ?

I tried with some other

5条回答
  •  一生所求
    2021-01-26 05:02

    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.,

    preg_replace("/\.php$/", "", "refinish.php")
    

提交回复
热议问题