Can you not create a simple page, and test how this works for yourself?
Than would be a great learning expariance... ;)
something like this, in case you do not trust yourself to create such a
simple test:
<?php
$a=1;
?>
<p>HTML1</p>
<?php
print "a=" $a " , b=" $b;
?>
<p>HTML2</p>
<?php
$b=2;
?>
<p>HTML3</p>
<?php
print "a=" $a " , b=" $b;
?>