-1

In this example:

$x = $b && $c;
$y = $b and $c;

Why $x = true and $y = false ? are && not equal and ?

Kerrek SB
  • 447,451
  • 88
  • 851
  • 1,056
Kevin medou
  • 49
  • 12

2 Answers2

2

PHP: The first code will set $x to the result of the comparison $b with $c, both have to be true, The second code will set $y like $b and thant , compare the success of this with the value of $c

Ahmed Ziani
  • 1,166
  • 3
  • 13
  • 26
0

The precedence of operators is what makes the difference here.

PHP Operator Precedence

JavaScript Operator Precedence

Jay Blanchard
  • 33,530
  • 16
  • 73
  • 113