$TorrentInfo) foreach (array_keys($Torrents[$TorrentID]) as $TorrentKey) ${$TorrentKey}[$TorrentID] = $TorrentInfo[$TorrentKey]; array_multisort($$SortMethod, $SortOrder, $Torrents); } TorrentSort($Torrents, 'name', SORT_ASC); /* foreach ($Torrents as $Torrent) { echo $Torrent['id'].' '. $Torrent['name'].' '. $Torrent['size'].' '. $Torrent['downloaded'].' '. $Torrent['uploaded']."\n"; }*/ */ $Torrents = array( array( 'id' => 1, 'name' => 'a.torrent', 'size' => 2, 'downloaded' => 3, 'uploaded' => 4, ), array( 'id' => 2, 'name' => 'b.torrent', 'size' => 3, 'downloaded' => 4, 'uploaded' => 1, ), array( 'id' => 3, 'name' => 'c.torrent', 'size' => 4, 'downloaded' => 1, 'uploaded' => 2, ), array( 'id' => 4, 'name' => 'd.torrent', 'size' => 1, 'downloaded' => 2, 'uploaded' => 3, ) ); $TorrentStatus = array( array( 'id' => 2, 'blarg' => 'testing1', ), array( 'id' => 1, 'blarg' => 'zomg', ), array( 'id' => 4, 'blarg' => 'wtfbbq', ), array( 'id' => 3, 'blarg' => 'lawl', ), ); // I need to merge the above two arrays, by merging each 'id' together. // EG. I need to end with: (only shows one merge) /* array( array( 'id' => 1, 'name' => 'a.torrent', 'size' => 2, 'downloaded' => 3, 'uploaded' => 4, 'blarg' => 'testing1', ), ); */ ?>