Home Tutorial Php Phpbasics Tutorial PHP Escaping HTML Tag

 
 

Share on Google+Share on Google+
PHP Escaping HTML Tag
Posted on: March 6, 2010 at 12:00 AM
Advertisement
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";

</script>

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

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

Output:

hello
this is simple text
This is asp style
Advertisement

Related Tags for PHP Escaping HTML Tag:


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.

Posted on: March 6, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com