3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define('MY_CONSTANT', ['func' => function() { return 'hello world'; }]); MY_CONSTANT['func']();
Output for 7.2.6 - 7.3.0beta1
Warning: Constants may only evaluate to scalar values or arrays in /in/1ar5s on line 3 Warning: Use of undefined constant MY_CONSTANT - assumed 'MY_CONSTANT' (this will throw an Error in a future version of PHP) in /in/1ar5s on line 4 Warning: Illegal string offset 'func' in /in/1ar5s on line 4 Fatal error: Uncaught Error: Call to undefined function M() in /in/1ar5s:4 Stack trace: #0 {main} thrown in /in/1ar5s on line 4
Process exited with code 255.
Output for 7.0.0 - 7.1.20
Warning: Constants may only evaluate to scalar values or arrays in /in/1ar5s on line 3 Notice: Use of undefined constant MY_CONSTANT - assumed 'MY_CONSTANT' in /in/1ar5s on line 4 Warning: Illegal string offset 'func' in /in/1ar5s on line 4 Fatal error: Uncaught Error: Call to undefined function M() in /in/1ar5s:4 Stack trace: #0 {main} thrown in /in/1ar5s on line 4
Process exited with code 255.
Output for 5.6.0 - 5.6.21
Parse error: syntax error, unexpected '(' in /in/1ar5s on line 4
Process exited with code 255.
Output for 5.4.0 - 5.5.35
Parse error: syntax error, unexpected '[' in /in/1ar5s on line 4
Process exited with code 255.
Output for 5.2.3 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/1ar5s on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.2
<br /> <b>Parse error</b>: syntax error, unexpected '[' in <b>/in/1ar5s</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected '[' in <b>/in/1ar5s</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/1ar5s</b> on line <b>3</b><br />
Process exited with code 255.