lalabored Posted May 30, 2008 Share Posted May 30, 2008 I need a function that is able to evaluate a string. For example, I have $var = "3+4*5", is there a function that can be like function($var) = answer?? It has to be able to recognize that 4*5 is done first. Link to comment https://forums.phpfreaks.com/topic/107915-calculating-a-string/ Share on other sites More sharing options...
The Little Guy Posted May 30, 2008 Share Posted May 30, 2008 like this? eval(str_replace('"','','$var = "3+4*5";')); echo $var; Link to comment https://forums.phpfreaks.com/topic/107915-calculating-a-string/#findComment-553176 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.