Html encode in PHP
What is the easiest way to Html encode in PHP? By encode, do you mean: Convert all applicable characters to HTML entities? htmlspecialchars or htmlentities You can also use strip_tags if you want to remove all HTML tags : strip_tags Note: this will NOT stop all XSS attacks Encode.php <h1>Encode HTML CODE</h1> <form action='htmlencodeoutput.php' method='post'> <textarea rows='30' cols='100'name='inputval'></textarea> <input type='submit'> </form> htmlencodeoutput.php <?php $code=bin2hex($_POST['inputval']); $spilt=chunk_split($code,2,"%"); $totallen=strlen($spilt); $sublen=$totallen-1; $fianlop