Browser Output <?php $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); echo $new; // <a href='test'>Test</a> // view source code output ?> <a href='test'>Test</a>
htmlspecialchars
function enables us to escape data before storage into the database.
<?php
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; // <a href='test'>Test</a>
?>
Note:
Note that this function does not translate anything beyond what is listed above. For full entity translation, see htmlentities().
htmlentities() example
<?php
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
?>
addslashes function enables us to escape data before storage into the database.
![image](/images/gyapti/user/93/anilbisht.jpg)
Anil Bist
Skills Php
Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,Location :-Dehradun,Dehradun,Uttarakhand,
Description:-
I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore
Students (5)
![](/Classroom/images/question.png)
![image](/images/gyapti/user/403/live_rauthanshubham.jpg)
![](/Classroom/images/question.png)
![](/img/default/default.jpg)
![](/Classroom/images/question.png)
![](/img/default/default.jpg)
![](/Classroom/images/question.png)
![](/img/default/default.jpg)
![](/Classroom/images/question.png)
![image](/images/gyapti/user/164/1499153505_866_hidden_face_girls_stylish_profile_pics_dp_for_whatsapp_facebook.jpg)
Recommended Classes
![image](/images/gyapti/user/93/anilbisht.jpg)
![image](/images/gyapti/user/673/IMG_2472_JPG.jpg)
![image](/images/gyapti/user/673/IMG_2472_JPG.jpg)