This task is ideal for a do..while
loop:
$i = 0;
do {
echo strtoupper(date("j",mktime(0, 0, 0, 0,date("d")+$i,0)));
} while ($i++ < 6 && print "|");
The space is present because you had \n
in your output. Any whitespace will be made into a space by your browser.