Can i echo an html tag just as text and not html in PHP?

Jim

New member
So if i do

echo "<div>";

then if obviouly oesn't display as text of the output page as the browser treats it as the html it is, but say i just want to print that tag on the page for reference can i do this?

so have the browser not treat this partically output as html but just like saying

echo "some text";
 
You can. But make sure you add New Line characters for each echo line. It will render in all browsers without a line for each tag, but it will improve readability with. You can escape the HTML. So for example, this could be your PHP document, saved as a PHP file (.php):

HTML Code Here
<? php

php code here

?>

More HTML

<? php

More php

?>


etc..... You can put PHP blocks wherever in the PHP document, just add the PHP tags.
You can also add php to .html and .htm files, as long as your .htaccess file is configured to allow this.
 
Back
Top