parsing - Convert a string formula into its result php -


this question has answer here:

i have string formula fetch file :

  $text = "100*20"; 

i want find way convert formula result, instance have value 200. possible using php?

use eval().

$expression = '100*20'; eval('$result = ('.$expression.')'); echo $result; 

Comments