3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define('TEST', [1,2]); var_dump(TEST); const TEST1 = [1,2]; var_dump(TEST1);
based on Y67F1
Output for 7.0.0 - 7.2.0
array(2) { [0]=> int(1) [1]=> int(2) } array(2) { [0]=> int(1) [1]=> int(2) }
Output for 5.6.8 - 5.6.28
Warning: Constants may only evaluate to scalar values in /in/pAVuQ on line 3 Notice: Use of undefined constant TEST - assumed 'TEST' in /in/pAVuQ on line 5 string(4) "TEST" array(2) { [0]=> int(1) [1]=> int(2) }
Output for 5.4.0 - 5.5.35
Fatal error: Arrays are not allowed as constants in /in/pAVuQ on line 7
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/pAVuQ on line 3
Process exited with code 255.