How to calculate strings with PHP
Posted by admin in
featured,
PHP/mySQL on 04 27th, 2010 |
10 Comments
Ever wondering to calculate 2 + 2 ? Sure you have.
But what if your formula comes in a string input ?
So, how to calculate “2 + 2″ or “4 * ( 3 – 5 )” in PHP ?
We’ll have the function calculate_string($mathstring).
function calculate_string( $mathString ) {
$mathString...