There's two answers depending on whether or not you count lines with only spaces and tabs as "empty".
If you don't (that is, you distinguish between "empty" and "blank") then
$aaa=preg_replace("/\n\n+/","\n",$aaa);
will do the job.
If, on the other hand, you want to get of blank lines as well,
$aaa=preg_replace("/\n\s*?\n+/","\n",$aaa);
and the "\s*" will match such (possible) whitespace.
Of course, this assumes that newlines aren't Windows newlines. If they might be, then the two regexps become
/\r?\n(\r?\n)+/
and
/\r?\n)\s*?(\r?\n)+/
respectively.