3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); enum Foo: int { case Bar = 0; } var_dump(Foo::from('0e0'));
Output for 8.1.30 - 8.1.34, 8.2.21 - 8.2.30, 8.3.5 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: Foo::from(): Argument #1 ($value) must be of type int, string given in /in/WIluI:7 Stack trace: #0 /in/WIluI(7): Foo::from('0e0') #1 {main} thrown in /in/WIluI on line 7
Process exited with code 255.
Output for 8.0.0 - 8.0.1
Parse error: syntax error, unexpected identifier "Foo" in /in/WIluI on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.26, 7.4.0 - 7.4.14
Parse error: syntax error, unexpected 'Foo' (T_STRING) in /in/WIluI on line 3
Process exited with code 255.

preferences:
41.56 ms | 931 KiB | 4 Q