The PHP runs, outputting anything outside the <?php ?>
tags as it goes.
The output might be buffered and then sent in one go once the script has finished.
The output might be sent bit by bit as the script outputs it.
(Which depends on how the script is written).
If you have <?php foo(); ?>
just after <body>
, then it will send the body start tag to output, then execute foo
, then output whatever follows.