Re: Doing simple math
| From: | Lars Torben Wilson | Date: | Wed, 04 Jun 2003 02:59:24 +0000 |
| Subject: | Re: Doing simple math | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150100@lists.php.net to get a copy of this message | ||
On Tue, 2003-06-03 at 19:49, Chris Cameron wrote:
> I'm having a problem I don't think I should be having. Basically, I'm
> doing some simple math, and I'm having issues in making PHP do it (with
> the brackets in particular).
>
> An example that looks like it -should- work:
>
> $Math = sqrt(81)(5+4)-1;
>
> Well of course that doesn't work because of the (I believe) brackets.
> I'm unable to think of any easy alternative that wouldn't make
> reading/writing these things terribly messy/hard.
>
> The above examples I just pulled out of the air, but I need to deal with
> many groupings with brackets, various functions (pow() and sqrt()
> mostly) and basic addition and subtraction, which adds a greater
> complexity.
>
> Have I missed something obvious? Or am I doomed to do a bunch of smaller
> math things so that I can do these bigger ones?
What is the relation between the sqrt(81) and the (5+4)-1? i.e. there
is no operator there...which operator *should* be there?
Torben
> Thanks,
> Chris
>
> --
> Chris Cameron
> UpNIX Internet Administrator
> ardvark.upnix.net
> bitbucket.upnix.net
> --
> http://www.upnix.com
--
Torben Wilson <torben@php.net> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----