3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public static function test() { echo 'Ok!<br>'; } } define('CONFIG', [ Foo::test(), 'ok!' ]); var_dump(CONFIG[0]);
based on hheZj
Output for 7.0.0 - 7.2.0
Ok!<br>NULL
Output for 5.6.8 - 5.6.28
Ok!<br> Warning: Constants may only evaluate to scalar values in /in/DFSJ2 on line 14 Notice: Use of undefined constant CONFIG - assumed 'CONFIG' in /in/DFSJ2 on line 16 string(1) "C"
Output for 5.4.10 - 5.5.35
Parse error: syntax error, unexpected '[' in /in/DFSJ2 on line 16
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/DFSJ2 on line 11
Process exited with code 255.