On Sat, 2004-02-07 at 23:50, Michal Migurski wrote:
> Another possibility is to pipe the expression to bc, which could do the
> input check for you, and probably covers a lot of syntactic ground.
> Slightly less resource-efficient, but you don't have to reinvent the
> wheel (untested, unix only):
>       $result = shell_exec("echo '${expr}' | bc");

Both eval and piping to bc via the shell work but open up big security
holes if you are not careful.  If you have bcmath or gmp enabled in php
I recommend looking at these functions:
http://www.php.net/manual/en/function.gmp-mul.php
http://www.php.net/manual/en/function.bcmul.php

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to