Jump to content

Order of Operations


ShoeLace1291

Recommended Posts

Does PHP use the order of operations crap in mathematics?  You know the old please excuse my dear aunt sally crap.  I'm trying to incorporate a formula that my friend and I came up with for a league system that figures out what amount of experience each team gets after a match.  My question is that what syntax would I need to use for a formula like this:

 

[(5/L)W] + [N+(W-L)] = x

Link to comment
Share on other sites

I usually go for readability, but yeah genericnumber1's is valid too.  And actually better since it's like .00000000001 seconds faster ;p.

 

 

You actually used the order of operations hehe.  I'm an over-grouper.  Calculators have trained me that way x.x.  Should've condensed it though.  I was just lazy.  Ironic, eh?

Link to comment
Share on other sites

I've had people look at math problems I've done before and tell me they're wrong because the order of operations is assumed lol.  On paper I don't use grouping symbols except when needed, but I find on a computer, since everything is typically written on one line (as in no division symbols except for / and so on), it's easier to comprehend with a crap load of parenthesis.

Link to comment
Share on other sites

The only time I find myself using tons of parenthesis in programming are those confusing if/then conditionals everyone loves

 

if ((something || something) && (something && (something || something)) {

 

of course I try to avoid them when neccessary, but worrying about the fact that && is higher precedence than || is just a pain... so I parenthesis up.

Link to comment
Share on other sites

Hrmmm learned something ;p.  I actually found that page after reading your post, but then I forgot about this thread lol.

 

 

Edit:

 

Things like

 

C:\Users\Corbin>php -r "var_dump(false && false || true && false);"

bool(false)

 

Were why I had assumed they have the same order of operations.  But, either way would make sense in that specific context.  I guess I shouldn't assume ;p.

Link to comment
Share on other sites

hello sir,  i have one question regarding mathematic operators that i have three pages and all paged having radio button values. one page having only one value so it is very simple to move this value to next page. but second pages having two radio buttons values plus previous page value. please help me to fix out our problem thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.