if you're printing to html use <? and ?> to close and open the script. Or you you can htmlspecialchars() everything and it will print fine.
If you are going to a text file, use chr(60).'?' and '?'.chr(62)
This way php does not know the content between the <? ?> is code.
Jack