RE: [PHP] Mathmatical formula

2005-12-20 Thread Jay Blanchard
[snip] I have an application that allows the users to input a formula: (Width*Height)/144 This formula gets updated with a part's specific width height and actually returns: (36.0*58.0)/144 I use preg_replace to replace Width and Height with values from the following array: [Width] =

Re: [PHP] Mathmatical formula

2005-12-20 Thread Mike Smith
Try; $foo = preg_replace($find,$replace,$partFormula); return $foo Unfortunately no. I also tried making the formula look like this: ?php (36.0*58.0)/144 ? and returning it with: eval('?' . $a . '?php '); Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] Mathmatical formula

2005-12-20 Thread Jay Blanchard
[snip] Try; $foo = preg_replace($find,$replace,$partFormula); return $foo Unfortunately no. I also tried making the formula look like this: ?php (36.0*58.0)/144 ? and returning it with: eval('?' . $a . '?php '); [/snip] Let's do an experiment. Place these two lines of code in a page,

Re: [PHP] Mathmatical formula

2005-12-20 Thread Mike Smith
Let's do an experiment. Place these two lines of code in a page, then load it in a browser; ?php $foo = (36.0*58.0)/144; echo $foo; ? works fine for me. If you change ?php (36.0*58.0)/144 ? to ?php echo (36.0*58.0)/144; ? Yep, that does work. Thanks Jay.