I'm using imap_search to retreive all e-mails from a mailbox.
See: http://php.net/manual/en/function.imap-search.php
Is it safe to assume that imap_search() retreives the e-mail ordered by date, oldest first? It does seem so from my testing, but I can't find any documentation on the actual ordering.
If it is ordered by date, you could use array_reverse() and array_splice() to get the newest 10 or so.
Example code:
<?php
$conn = imap_open('{imap.example.com:993/imap/ssl}INBOX', 'foo@example.com', 'pass123', OP_READONLY);
$msgnos = imap_search($conn, 'ALL');
?>