Jump to content

What is wrong with htmlspecialchars Not working


manalnor

Recommended Posts

Hello dears,

 

I've tried to use

htmlspecialchars

or

htmlentities

 

but both no longer work !

 

Example1 :

 

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

 

Output should <a href=&#039;test&#039;>Test</a>

 

<?php
$str = "A 'quote' is <b>bold</b>";
echo htmlentities($str);
?>

 

Output should A 'quote' is <b>bold</b>

 

But it isn't working ? what is wrong ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.