3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $good =['name'=> 'prinsha','surname'=> 'jangam']; $good['doggy'] = 'newjippu'; //echo $good['name']; foreach($good as $key=>$item){ echo $key .' '.$item. "\n"; } $array = [1, 2, 3,4, 5] ; // Mulltidimensional array $dogs = [ ['breed' => 'Cocker Spaniel', 'name' => ' Jypsy', 'size' => [ 'width': 5, 'height': 10]], ['breed' => 'german ', 'name' => ' Jypsy', 'size' => [ 'width': 5, 'height': 10]], ['breed' => 'Shiba Inu', 'name' => ' Kotetsu', 'size' => [ 'width': 5, 'height': 10]], ['breed' => 'Unknown', 'name' => ' Sheru Bahadur', 'size' => [ 'width': 5, 'height': 10]], ]; echo $dogs[0]; // we can use this to represent record of any kind, for example student record, anything, even complex things
based on dscAk
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.7
Parse error: syntax error, unexpected ':', expecting ']' in /in/i7tF3 on line 14
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected ':', expecting ']' in /in/i7tF3:14 Stack trace: #0 {main}
Process exited with code 255.