All pastes #764718 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-07 14:36 UTC
rendered paste body
<?

function order_email($a, $b){

	// is $a and $b an id from the array? or what is it?

	global $imap;
	
	$timea = imap_headerinfo($imap, $a);
	$a = $time->udate; // get the time the email was sent in unixtime
	
	$timeb = imap_headerinfo($imap, $b);
	$b = $time->udate; // get the time the email was sent in unixtime
		
	if ($a == $b) {
	
		return 0;
		
	}
	
		return ($a < $b) ? -1 : 1;
	
	}

}

$mails = imap_search($imap, "UNDELETED"); // Gets array with id's of mails

usort($mails, "order_email"); // The array of mails should be ordered by the time they were recieved

?>