Like this mabye?
// Where $i is some msg number
$array = imap_sort($stream,1,1);
$msg = imap_header($stream,$array[$i]);
$from = $msg->from[0];
$personal = $from->personal;
echo $personal;
$from is an object see
http://www.php.net/manual/en/function.imap-headerinfo.php
in the manual.
Subject just is $msg->Subject;
Hope this helps!