3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php const FLAG_1 = 0b0001; // 1 const FLAG_2 = 0b0010; // 2 const FLAG_3 = 0b0100; // 4 const FLAG_4 = 0b1000; // 8 // Can you see the pattern? ;-) function render($flags, $flag) { $result = FALSE; if ($flags & $flag) { $result = TRUE; } echo $result; } render(FLAG_4 | FLAG_3 | FLAG_1, FLAG_1 | FLAG_2);
based on SKc2Q
Output for 5.4.0 - 7.2.0
1
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /in/pqIvl on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/pqIvl on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CONST in /in/pqIvl on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/pqIvl on line 3
Process exited with code 255.