Left-to-right evaluation of && operators has one useful feature: evaluation stops after first "false" operand is encountered.
This feature can be useful for creating following construction:
$someVar==123 is not evaluated, so there will be no warnings such as "Undefined variable $someVar":
<?php
if ((!empty($someVar))&&($someVar==123))
{
echo $someVar;
}
?>
Function someFunc($someVar) will not be called:
<?php
if ((!empty($someVar))&&(someFunc($someVar)))
{
echo $someVar;
}
?>
This will give "Warning: Undefined variable $someVar" error. Order matters:
<?php
if ((someFunc($someVar))&&(!empty($someVar)))
{
echo $someVar;
}
?>