I want to evaluate a mathematical operations inside the string after I get it in that string. Here is the string
$string = "Add this two numbers [4+2+2]. And [5*3/2] will result to?" I already get those numbers:
$f_number = "4+2+2"; $s_number = "5*3/2"; How can I evaluate this automatically using any function? Sample:
echo anyfunction($f_number);//will result to 8 echo anyfunction($s_number);//will result to 7.5 because if I will echo directly it will just output like this:
echo $f_number;//will result to 4+2+2 echo a$s_number;//will result to 5*3/2