3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('WARRIOR_OFFSET', 16); define('MAGE_OFFSET', 17); define('CLASS_MASK', ( 1 << WARRIOR_OFFSET ) | ( 1 << MAGE_OFFSET )); define('CF_GOD', 1 << 2); // may issue #god commands define('CF_PLAYER', 1 << 3); // is a player define('CF_STAFF', 1 << 4); // member of the staff define('CF_INVISIBLE', 1 << 5); // character is completely invisible define('CF_GENDER', 1 << 14 | 1 << 15); // Determine Gender define('CF_ARCH', 1 << 18); // is arch-XXX define('CF_LQMASTER', 1 << 52); // may host LQs define('CF_NOWHO', 1 << 56); // invisible to /who define('CF_WON', 1 << 57); // character won the game (ie killed islena $bitmask = 81920; $classMap = array( 0b00 => 'error', 0b01 => 'warrior', 0b10 => 'mage', 0b11 => 'seyan', ); $class = $bitmask & CLASS_MASK; $class = $class >> WARRIOR_OFFSET; $class_name = $classMap[$class]; $is_god = $bitmask & CF_GOD; print "$class_name\n"; if ($is_god) { print "This player is god\n"; }

preferences:
37.84 ms | 402 KiB | 5 Q