Php – Do I need to escape this

escaping, php

It might be a bit unusual, but I need to echo <?php. However, I think that PHP treats it as an actual <?php and starts executing code instead of treating it as a string. How can I escape <?php and ?> so they can be treated as strings? There was nothing in the manual about this.

Thanks, I know this is a bit unusual.

Best Solution

You can use the &lt; and &gt; html entities (to replace '<' and '>'). These are only handled in the browser, so PHP would not attempt to run that code.