Skip to content

Poop Code

  • Home
  • Linux

How to escape html tags in PHP?

October 29, 2024 by poopcode
/*  EXAMPLE:	<p>Bed & Breakfast</p>	-->	  <p>Bed &amp; Breakfast</p>  
    & 	&amp;
    " 	&quot; 				(unless ENT_NOQUOTES is set)
    ' 	&#039; or &apos; 	(ENT_QUOTES must be set)
    < 	&lt;
    > 	&gt;				*/

<?php
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; 					// <a href='test'>Test</a>
?>
Categories Linux
Manasa and Stones – Hackerrank Challenge – C# Solution
Pass arguments to your node.js app from pm2
© 2025 Poop Code • Built with GeneratePress