str_replace 个字符和另外 2 个字符
str_replace characters with 2 other characters
我正在尝试将 ,
替换为 .
并将 '
替换为 `
我可以这样做
$bodyweight = str_replace("'", "`", $form->data['bodyweight']);
$bodyweight = str_replace(',', '.', $bodyweight);
有没有一种方法可以同时完成 str_replace?
刚刚阅读 documentation:
$bodyweight = str_replace(array("'", ','), array("`", '.'), $form->data['bodyweight']);
我正在尝试将 ,
替换为 .
并将 '
替换为 `
我可以这样做
$bodyweight = str_replace("'", "`", $form->data['bodyweight']);
$bodyweight = str_replace(',', '.', $bodyweight);
有没有一种方法可以同时完成 str_replace?
刚刚阅读 documentation:
$bodyweight = str_replace(array("'", ','), array("`", '.'), $form->data['bodyweight']);