All pastes #463957 Raw Edit

Someone

public php v1 · immutable
#463957 ·published 2007-04-29 07:11 UTC
rendered paste body
<?php	/*	 *	Copyright © Malcolm Jarvis and Kendall Hopkins	 *	This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 license.	 *	For more details, see http://creativecommons.org/licenses/by-nc-sa/3.0/	 *//*	// Valid Sort options: SORT_ASC, SORT_DESC	function TorrentSort(&$Torrents, $SortMethod = 'name', $SortOrder = 4)	{		foreach ($Torrents as $TorrentID => $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',			),		);	*/?>