日期:2014-05-17 浏览次数:20679 次
$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)