Truncate the string and assemble it. Give me some ideas. Three treatment rooms nursing fee + three treatment rooms nursing treatment fee + three treatment rooms hosting fee + (total number of three treatment rooms per day + number of three treatment rooms admitted * 3 + number of discharged persons from three treatment rooms * 0.3) extract the Chinese character above, and I will get the corresponding fee in the database, and then compress it in the Assembly. My processing intercepts the string and then assembles it. Give me some ideas.
Three treatment rooms nursing fee + three treatment rooms nursing treatment fee + three treatment rooms hosting fee + (total number of three treatment rooms per day + number of three treatment rooms admitted * 3 + number of discharged persons from three treatment rooms * 0.3) extract the Chinese character above, and I will get the corresponding fee in the database, and then compress it in the Assembly. My processing is to replace all operators with "," and then separate them. Now, how can we assemble data.
------ Solution --------------------
PHP code
$ Str = 'three treatment rooms nursing fee + three treatment rooms nursing treatment fee + three treatment rooms hosting fee + (total daily amount of three treatment rooms + three treatment rooms admission * 3 + three treatment rooms discharged number of students * 0.3) '; preg_match_all ("| [^ 0-9 *. + ()] + | ", $ str, $ matches); $ ar_txt = array_values ($ matches [0]); $ ar_val = array (1, 2, 3, 4, 5, 6 ); // price value corresponding to the Chinese project $ str = str_replace ($ ar_txt, $ ar_val, $ str); echo $ str; // 1 + 2 + 3 + (4 + 5*3 + 6*0.3)