CKTIS / PHP
Expressions and operators
Precedence groups operators into expressions.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
($a + $b) * $c; $left && $right;Precedence groups operators into expressions. Multiplication binds more tightly than addition, and parentheses specify another grouping. Short-circuit && skips its right operand when the left value is false. Grouping alone does not in general guarantee the evaluation order of independent operands.
$calls=0; $check=function() use (&$calls){++$calls;return true;}; $a=false && $check(); $b=true && $check();
echo json_encode([2+3*4,(2+3)*4,$a,$b,$calls]);
[14,20,false,true,1]
Examples
<?php
$calls=0; $check=function() use (&$calls){++$calls;return true;}; $a=false && $check(); $b=true && $check();
echo json_encode([2+3*4,(2+3)*4,$a,$b,$calls]);
Result
[14,20,false,true,1]