new2php
new2php

Reputation: 21

How to output exact character string "<?php"

I'm new to php, I have not been able to figure out how to output the exact string "<?php" as either an HTML string, outputing from a file (i.e. file_get_contents(blah);), or with echo "<?php"; inside a code segment. I assume it is getting interpreted as the opening of a php code segment because no data is output. Any help would be appreciated.

Upvotes: 2

Views: 662

Answers (2)

Madara&#39;s Ghost
Madara&#39;s Ghost

Reputation: 174977

More likely it's interpreted as an HTML tag, use

header("Content-type: text/plain");

Or replace the < with &lt;.

Upvotes: 3

ceejayoz
ceejayoz

Reputation: 180023

Should work fine:

<?php

print "<?php";

Upvotes: 3

Related Questions