Re: math functions
by "Ryan Fischer" <ryan(at)gigabee.com>
|
| Date: |
Fri, 11 Apr 2003 17:55:19 -0400 |
| To: |
"Keith D Sellars" <Keith(at)webgraffix.com>, <hwg-languages(at)hwg.org> |
| References: |
S0026260871 |
| |
todo: View
Thread,
Original
|
|
> Hi guys,
>
> I have a form on which I wish to do a simple calculation in php.
>
> Here is what I need to do:
>
> x = [a + .25(f-25)) + d + e] * [1 + g] all divided by 2 (or
multiplied by
> .5 whichever is easiest coding)
>
> Here is a link so you can see what I'm trying to accomplish. I've
created a
> mathematical formula (above), that works correctly if I can just
duplicate
> it in the appropriate php code.
>
> https://www.webgraffix.com/postsearchlight/Classifieds2.php
>
> I know it's probably a simple thing, but I keep running into errors
when I
> try to do it. Any help would be greatly appreciated.
Use parenthesis where needed:
$x = (($a + (.25 * ($f - 25))) + $d + $e) * (1 + $g)) / 2;
// or * .5; it doesn't matter
HTH!
-Ryan Fischer
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.