3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { const PHONE_NUMBER_LIST_OPTION_TRIM_EXTENSION=0x01; // 0b00000001 const PHONE_NUMBER_LIST_OPTION_ONLY_WITH_EXTENSION=0x02; // 0b00000010 public static function test($options=null) { $options=intval($options); echo "TEST: ".decbin($options)."\n"; var_dump($options&self::PHONE_NUMBER_LIST_OPTION_TRIM_EXTENSION); var_dump($options&self::PHONE_NUMBER_LIST_OPTION_ONLY_WITH_EXTENSION); echo "\n\n"; } } A::test(); A::test(A::PHONE_NUMBER_LIST_OPTION_TRIM_EXTENSION); A::test(A::PHONE_NUMBER_LIST_OPTION_ONLY_WITH_EXTENSION); A::test(A::PHONE_NUMBER_LIST_OPTION_TRIM_EXTENSION&A::PHONE_NUMBER_LIST_OPTION_ONLY_WITH_EXTENSION);
based on OHGXo
Output for 5.6.0 - 5.6.30, hhvm-3.12.14 - 3.17.3, 7.0.0 - 7.3.0rc4
TEST: 0 int(0) int(0) TEST: 1 int(1) int(0) TEST: 10 int(0) int(2) TEST: 0 int(0) int(0)