PHP htmlentities() Function

The htmlentities() function is used to convert characters to HTML tags or entities.

Demo :



Type Text

Example :

Type sentance at text box like this 'Hello World' and click convert button the result will display 'Hello world' also take view source result will be 'Hello World'

If you need to add HTML tags or entities for a sentence following code useful to you.


<?php
$str = "Hello World";
$result = htmlentities($str,ENT_QUOTES);
echo $result;
?>

In the above code is used to convert characters to HTML tags or entities .The sentence will pass to the htmlentities() function.Finally output will display &#039;Hello World&#039;.

In the htmlentities() function have three parameters that name is string string,int quote_style,string charset.

Free Download Script :

If you need htmlentities() function demo code download from following link.

Download




Content