Share on Google+Share on Google+

PHP Escaping HTML Tag

In this current tutorial we will study about how to escape from HTML tag, there are mainly four ways to do this, each of these tags are explained in this tutorial subsequently you can check the examples for better understanding

PHP Escaping Html Tag:

During the parsing of a file by PHP, it looks for opening and closing tags which indicates the starting and closing point of PHP. The parser ignores the coding outside of the tag. In general we use <?php ?> tag to mention the PHP portion. It is not mandatory to mention the closing tag all the time, unless you need to embed html or any other scripting tag.

In the example given below we are discussing three kind of special tags, first one is available in all php version, but rest of the two are not, to make it available you need to do some small changes in php.ini file. Find out short_open_tag and asp_tag, change the default value off to on and after that restart the server. 

Example of PHP Escape Html Tags:

<script language="php">

echo "hello";


<?echo "this is simple text <Br/>"; ?>

<%echo "This is asp style";%>


this is simple text
This is asp style



Posted on: March 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null