3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class EnumShit { const SHOW_TEST = pow(0, 2); // 2 ^ 0 const SHOW_DERP = pow(1, 2); // 2 ^ 1 const SHOW_FOO = pow(2, 2); // 2 ^ 2 public function __construct($type) { switch ($type) { case self::SHOW_DERP: echo "Showing derp!\n"; break; case self::SHOW_TEST: echo "Showing Test!\n"; break; case self::SHOW_FOO: echo "Showing Test!\n"; break; case self::SHOW_DERP | self::SHOW_TEST: echo "Showing both DERP and TEST!\n"; break; case self::SHOW_FOO | self::SHOW_TEST: echo "Showing both FOO and TEST!\n"; break; case self::SHOW_DERP | self::SHOW_FOO: echo "Showing both DERP and FOO!\n"; break; case self::SHOW_DERP | self::SHOW_TEST | self::SHOW_FOO: echo "Showing ALL!\n"; break; } } } // Foo and Test new EnumShit(EnumShit::SHOW_TEST | EnumShit::SHOW_FOO);
Output for 5.3.0 - 5.4.25
Parse error: syntax error, unexpected '(', expecting ',' or ';' in /in/V1FoI on line 4
Process exited with code 255.