3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dataArray = [ 'items' => [ 4 => [ [id] => 4, [name] => 'Test Item 4 Name', [desc] => 'Test Item 4 Desc', ], 5 => [ [id] => 5, [name] => 'Test Item 5 Name', [desc] => 'Test Item 5 Desc', ], 6 => [ [id] => 6, [name] => 'Test Item 6 Name', [desc] => 'Test Item 6 Desc', ] ] ]; var_dump($dataArray); exit;
based on HKtb6
Output for 7.2.0
Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 6 Warning: Illegal offset type in /in/OB3E3 on line 6 Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 7 Warning: Illegal offset type in /in/OB3E3 on line 7 Warning: Use of undefined constant desc - assumed 'desc' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 8 Warning: Illegal offset type in /in/OB3E3 on line 8 Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 11 Warning: Illegal offset type in /in/OB3E3 on line 11 Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 12 Warning: Illegal offset type in /in/OB3E3 on line 12 Warning: Use of undefined constant desc - assumed 'desc' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 13 Warning: Illegal offset type in /in/OB3E3 on line 13 Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 16 Warning: Illegal offset type in /in/OB3E3 on line 16 Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 17 Warning: Illegal offset type in /in/OB3E3 on line 17 Warning: Use of undefined constant desc - assumed 'desc' (this will throw an Error in a future version of PHP) in /in/OB3E3 on line 18 Warning: Illegal offset type in /in/OB3E3 on line 18 array(1) { ["items"]=> array(3) { [4]=> array(0) { } [5]=> array(0) { } [6]=> array(0) { } } }
Output for 5.4.2 - 7.1.10
Notice: Use of undefined constant id - assumed 'id' in /in/OB3E3 on line 6 Warning: Illegal offset type in /in/OB3E3 on line 6 Notice: Use of undefined constant name - assumed 'name' in /in/OB3E3 on line 7 Warning: Illegal offset type in /in/OB3E3 on line 7 Notice: Use of undefined constant desc - assumed 'desc' in /in/OB3E3 on line 8 Warning: Illegal offset type in /in/OB3E3 on line 8 Notice: Use of undefined constant id - assumed 'id' in /in/OB3E3 on line 11 Warning: Illegal offset type in /in/OB3E3 on line 11 Notice: Use of undefined constant name - assumed 'name' in /in/OB3E3 on line 12 Warning: Illegal offset type in /in/OB3E3 on line 12 Notice: Use of undefined constant desc - assumed 'desc' in /in/OB3E3 on line 13 Warning: Illegal offset type in /in/OB3E3 on line 13 Notice: Use of undefined constant id - assumed 'id' in /in/OB3E3 on line 16 Warning: Illegal offset type in /in/OB3E3 on line 16 Notice: Use of undefined constant name - assumed 'name' in /in/OB3E3 on line 17 Warning: Illegal offset type in /in/OB3E3 on line 17 Notice: Use of undefined constant desc - assumed 'desc' in /in/OB3E3 on line 18 Warning: Illegal offset type in /in/OB3E3 on line 18 array(1) { ["items"]=> array(3) { [4]=> array(0) { } [5]=> array(0) { } [6]=> array(0) { } } }
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/OB3E3 on line 3
Process exited with code 255.