3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $json = array( '123' => array('data' => array('categories' => array( array( 'id' => '2', 'description' => 'Single-player' ), array( 'id' => '1', 'description' => 'Multi-player' ), array( 'id' => '9', 'description' => 'Co-op' ), array( 'id' => '22', 'description' => 'Steam Achievements' ), array( 'id' => '28', 'description' => 'Full controller support' ) )) ), '456' => array('data' => array('categories' => array( array( 'id' => '21', 'description' => 'Downloadable Content' ) )) ), ); //print_r($json); $merged = array(); foreach($json as $j1) { foreach($j1 as $j2) { foreach($j2 as $key => $j3) { $merged[$key] => $j3; } } } print_r($merged);
based on QaqCZ
Output for 5.4.0 - 5.4.31
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/tMdir on line 44
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_DOUBLE_ARROW in /in/tMdir on line 44
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
Parse error: parse error, unexpected T_DOUBLE_ARROW in /in/tMdir on line 44
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/tMdir on line 44
Process exited with code 255.