3v4l.org

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