Yep, that's normal behaviour.
PHP code is pre-processed on the server, and the results are sent to the client. The client then interprets it. Typically, this is used in a web environment, so PHP generates the dynamic content and sends the results in HTML:
Would be the PHP code, and what the browser sees is:
if (date("a") == "pm")
$sPartOfDay = "evening";
$sPartOfDay = "morning";
printf('<p>good %s</p>', $sPartOfDay);
or good morning if its 'am'. So what you see in the browser is only what is printed or echo'd to the browser, or anything outside of <?php and ?> tags.