3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = 1; // Imagine value of X // Start Evaluation with && if (logicalString("x=1") && logicalString("x=0")) { echo "&& - True\n"; } else { echo "&& - False\n"; } // Start Evaluation with || if (logicalString("x=1") || logicalString("x=0")) { echo "|| - True\n"; } else { echo "|| - False\n"; } function logicalString($str) { parse_str($str, $v); foreach ( $v as $k => $var ) { if (! isset($GLOBALS[$k]) || $GLOBALS[$k] != $var) return false; } return true; } ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
&& - False || - True