3v4l.org

run code in 200+ php & hhvm versions
<?php class A { const FOO = [1]; } ReflectionClass::export("A");
Output for 7.1.0 - 7.2.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 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.