时间:2021-07-01 10:21:17 帮助过:5人阅读
$str = '三部处置室护理费+三部处置室护理治疗费+三部处置室化验费+(三部处置室床日总量+三部处置室入院人数*3+三部处置室出院人数*0.3)'; preg_match_all("|[^0-9*.+()]+|", $str, $matches); $ar_txt = array_values($matches[0]); $ar_val = array(1,2,3,4,5,6); //中文项目对应的价格数值 $str = str_replace($ar_txt, $ar_val, $str); echo $str; //1+2+3+(4+5*3+6*0.3)