?
Solved

PHP If statements. Stacked parentheses explained?

Posted on 2012-04-04
2
Medium Priority
?
163 Views
Last Modified: 2012-04-04
Hi,

Can someone please explain the proper use of stacked parentheses like so:

if( $x == 3 && $y == 8 ){
    echo 'hi';
}

Against:

if( ( $x == 3 ) && ( $y == 8 ) ){
    echo 'hi';
}

What would be the significance of the added parentheses?

Thank you
0
Comment
Question by:wilson1000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 37805607
Just like math class -- to distinguish which comparisons are executed first.
0
 
LVL 4

Author Closing Comment

by:wilson1000
ID: 37806466
Thank you
0

Featured Post

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question