PHP
<?PHP $str='<table><tr><td>name<td>address</table>'; echo $str; //<table><tr><td>name<td>address</table> echo htmlspecialchars($str); //<table><tr><td>name<td>address</table> $str="<table><tr><td>name<td>address</table>"; echo htmlspecialchars($str); //Not converted //<table><tr><td>name<td>address</table>?>
<?PHP $str = 'test@gmail.com donated $4 dollars'; echo htmlentities($str); //test@gmail.com "donated $4 dollars ?>
PHP
<?PHP $str=htmlspecialchars('<table><tr><td>name<td>address</table>'); echo $str; //<table><tr><td>name<td>address</table> $str2 = htmlspecialchars_decode($str); echo $str2; //<table><tr><td>name<td>address</table> ?>