.


Divya

htmlentities() Function in PHP


In PHP the htmlentities() function used to converts characters to HTML entities.

Syntax

htmlentities(string,flags,character-set,double_encode)

Example

<!DOCTYPE html>
<html>
<body>
<?php
$str = '<a href="https://www.studentstutorial.com">Go to studentstutorial.com</a>';
echo htmlentities($str);
?>
</body>
</html>

Output

<a href="https://www.studentstutorial.com">Go to studentstutorial.com</a>

.