[Phpwm] Fnuction to calculate a formula

Phil Beynon phil at infolinkelectronics.co.uk
Tue Dec 4 07:32:54 GMT 2007


>
>
> Hello,
> I am on the hunt for a PHP 5 function that will calculate a given formula.
> For example:
>
> $formula="2+2";
> $result=calculate_formula($formula);
> echo "$formula = $result";
>
> Would reult in:
>
> 2+2 = 4
>
> Anyone got any ideas?
> Cheers,
> Colin
>


Colin,
are the users entering the actual formula here?

eval() is OK if internal but it needs to be ringfenced if any user input can
be directed against it.

Phil
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.13/1165 - Release Date: 02/12/2007
20:34


More information about the Phpwm mailing list