-1

In this example:

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

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

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
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,206
  • 3
  • 14
  • 26
0

The precedence of operators is what makes the difference here.

PHP Operator Precedence

JavaScript Operator Precedence

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119