3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const FOO = [1]; } ReflectionClass::export("A");
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Uncaught Error: Call to undefined method ReflectionClass::export() in /in/X4EN0:6 Stack trace: #0 {main} thrown in /in/X4EN0 on line 6
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Deprecated: Function ReflectionClass::export() is deprecated in /in/X4EN0 on line 6 Class [ <user> class A ] { @@ /in/X4EN0 3-5 - Constants [1] { Constant [ public array FOO ] { Array } } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [0] { } }
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33
Class [ <user> class A ] { @@ /in/X4EN0 3-5 - Constants [1] { Constant [ public array FOO ] { Array } } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [0] { } }
Output for 5.6.28, 7.0.20
Class [ <user> class A ] { @@ /in/X4EN0 3-5 - Constants [1] { Constant [ array FOO ] { Array } } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [0] { } }
Output for 5.6.0 - 5.6.21, 7.0.0 - 7.0.6
Notice: Array to string conversion in /in/X4EN0 on line 6 Class [ <user> class A ] { @@ /in/X4EN0 3-5 - Constants [1] { Constant [ array FOO ] { Array } } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [0] { } }
Output for 5.5.0 - 5.5.35
Fatal error: Arrays are not allowed in class constants in /in/X4EN0 on line 4
Process exited with code 255.

preferences:
143.99 ms | 413 KiB | 5 Q