PHP: Text Processing preg_match function
问题 <?php $eqn1="0.068683000000003x1+2.046124y1+-0.4153z1=0.486977512"; preg_match("/\b[0-9]*\b/",$eqn1,$vx1); echo "X1 is: $vx1[0]"; ?> Can someone tell me, how to store the value of x1 (that is, 0.068683000000003) in the variable $vx1? The output is: X1 is: 0 回答1: 1)put semicolon after each sentences; 2)use echo "X1 is:" $vx1[0]; instead ofecho "X1 is: $vx1[0]"; <?php $eqn1="0.068683000000003x1+2.046124y1+-0.4153z1=0.486977512"; preg_match("/\b[0-9]*\b/",$eqn1,$vx1); echo "X1 is:" .$vx1[0]; 回答2