3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { const FROM_DB = 1; const PUBLIC_ONLY = 0; public static function getSomething($input, $db = 0, $public = 1) { return $input; } } echo MyClass::getSomething( 'test' | MyClass::FROM_DB | MyClass::PUBLIC_ONLY ); echo MyClass::getSomething( 6 | MyClass::FROM_DB | MyClass::PUBLIC_ONLY ); echo MyClass::getSomething( 'test', MyClass::FROM_DB | MyClass::PUBLIC_ONLY );
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: Unsupported operand types: string | int in /in/iT7ZS:12 Stack trace: #0 {main} thrown in /in/iT7ZS on line 12
Process exited with code 255.
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: A non-numeric value encountered in /in/iT7ZS on line 12 17test
Output for 5.6.0 - 5.6.38, 7.0.0 - 7.0.33
17test

preferences:
139.12 ms | 402 KiB | 256 Q