3v4l.org

run code in 300+ PHP versions simultaneously
<?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) { foreach($j3 as $j4) { $merged[$key][] = $j4; } } } } print_r($merged);

preferences:
61.27 ms | 402 KiB | 5 Q