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
Solved

PHP If statements. Stacked parentheses explained?

Posted on 2012-04-04
2
158 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
2 Comments
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replica website 2 35
Split wordpress loop 35 56
PHP and JQuery Syntax question 4 26
Programming Language for Wordpress 7 37
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to count occurrences of each item in an array.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

861 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