<?php for($i = 0; $i <= 1; $i++){ for($j = 0; $j <= 1; $j++){ for($k = 0; $k <= 1; $k++){ $a = (bool) $i; $b = (bool) $j; $c = (bool) $k; if ($a || $b and $c) { echo 'true '; } else { echo 'false'; } if ($a || $b && $c) { echo ' -> true '; } else { echo ' -> false'; } echo ' $a = ' . $i . ', $b = ' . $j . ', $c = ' . $k . PHP_EOL; } } }
Standard input is empty
false -> false $a = 0, $b = 0, $c = 0 false -> false $a = 0, $b = 0, $c = 1 false -> false $a = 0, $b = 1, $c = 0 true -> true $a = 0, $b = 1, $c = 1 false -> true $a = 1, $b = 0, $c = 0 true -> true $a = 1, $b = 0, $c = 1 false -> true $a = 1, $b = 1, $c = 0 true -> true $a = 1, $b = 1, $c = 1