mvnr_83
07-23-2008, 12:47 AM
Hi all,
I have a strange problem while calculating using a formula.
Here is my code
<?php
$num = 1000;
$num2 = 10;
$num3 = 50;
$formula = '(A1*A2)+A3';
$formula = str_replace('A1',$num,$formula);
$formula = str_replace('A2',$num2,$formula);
$formula = str_replace('A3',$num3,$formula);
echo $formula;
?>
i need the value of formula as 10050
The formula comes from database and it is in string format. it is not possible to remove quotes to $formula.
Please help me
Thanks
I have a strange problem while calculating using a formula.
Here is my code
<?php
$num = 1000;
$num2 = 10;
$num3 = 50;
$formula = '(A1*A2)+A3';
$formula = str_replace('A1',$num,$formula);
$formula = str_replace('A2',$num2,$formula);
$formula = str_replace('A3',$num3,$formula);
echo $formula;
?>
i need the value of formula as 10050
The formula comes from database and it is in string format. it is not possible to remove quotes to $formula.
Please help me
Thanks