Priority of Comparison Operations in PHP
The operation and has priority over or.
In the following example, the condition will trigger if
the variable $num is from 0 to 5
OR from 10 to 20:
<?php
$num = 3;
if ($num > 0 and $num < 5 or $num > 10 and $num < 20) {
echo '+++';
} else {
echo '---';
}
?>