CKTIS / PHP
Logical conjunction (and)
The word `and` requires two truthy operands and skips the right one when the left is false-like.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
($first and $second)The word and requires two truthy operands and skips the right one when the left is false-like. It has lower precedence than assignment. Without parentheses a variable can receive the left operand even though the full expression is false. Parentheses store the result of both tests.
($first and $second)
[true,false]
Examples
<?php
$first = true and false;
$whole = (true and false);
echo json_encode([$first,$whole]);
Result
[true,false]