regex - 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 tell me, how store value of x1 (that is, 0.068683000000003) in variable $vx1?

the output is:

x1 is: 0 

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];