Hi again,
I got this script found on internet as a response on another forum. And this does the job same way almost that eval() does. Anyone care to explain me what exactly is happening in this script? How and what exactly does the mathematical operations in this one?
PHP Code:
function calc_string( $mathString )
{
$cf_DoCalc = create_function("", "return (" . $mathString . ");" );
return $cf_DoCalc();
};
echo('<br>Result: ' . calc_string('3*4+2-13*(2.5*10*2*2/4)') );
echo('<br>Result: ' . calc_string('pow(10,3)') );
Bookmarks