how to escape html tags in php

141

how to escape html tags in php -

/*  EXAMPLE:	<p>Bed & Breakfast</p>	-->	  <p>Bed & Breakfast</p>  
    & 	&
    " 	" 				(unless ENT_NOQUOTES is set)
    ' 	' or ' 	(ENT_QUOTES must be set)
    < 	<
    > 	>				*/

<?php
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; 					// <a href='test'>Test</a>
?>

Comments

Submit
0 Comments