in reply to logical AND "&&"

In fact,
if (($a == 1 && $b < 2) && ($d < 4 && $e >= 6)) {
could be written as
if ($a == 1 && $b < 2 && $d < 4 && $e >= 6) {

Replies are listed 'Best First'.
Re^2: logical AND "&&"
by Anonymous Monk on Jan 31, 2010 at 17:14 UTC
    I heard you could write
    if($a==1&&$b<2&&$d<4&&$e>=6){

      It wasn't clear if he knew the parens weren't necessary. Also, it wasn't clear if he knew that

      if (($a == 1 && $b < 2) && ($d < 4 && $e >= 6)) {
      is the same as
      if ($a == 1 && ($b < 2 && ($d < 4 && ($e >= 6))) {

      Those are the two things I pointed out in my post. I wasn't trying to say that parens are bad. In this case, though, spacing can also provide clear disambiguation

      if ($a==1 && $b<2 && $d<4 && $e>=6) {