3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php define('FLAG_1', 1 << 0); define('FLAG_2', 1 << 1); define('FLAG_3', 1 << 2); define('FLAG_4', 1 << 3); define('FLAG_5', 1 << 4); define('FLAG_6', 1 << 5); define('FLAG_7', 1 << 6); define('FLAG_8', 1 << 7); define('FLAG_9', 1 << 8); $flags = FLAG_1 & FLAG_4; echo $flags & FLAG_1; echo $flags & FLAG_2; echo $flags | FLAG_1; if ($flags & FLAG_1) { echo "Flag 1 set."; } if ($flags & FLAG_2) { echo "Flag 2 set."; } if ($flags & FLAG_4) { echo "Flag 4 set."; } if ($flags & (FLAG_1 | FLAG_4)) { echo "Flag 1 and 4 set."; } if ($flags & (FLAG_1 | FLAG_2 | FLAG_4)) { echo "Flag 1, 2 and 4 set."; }
Output for 4.3.0 - 7.1.0
001