$total = 30 - $nr1 / 13 - $nr2 - 6 * $nr3 - 3
I know we learned that in school but what is first (+ or – or * or /), where are the brackets or do I even need them ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You put brackets to priortizes what should be calculated first. In math though it starts from division, multiplication, subtraction and finally addition. So, here is the order of precedence for these:
You can however override that rule by specifying brackets, for example you might want to have addition calculated first before anything else.
More Info: