I try this code
<?php
$new = htmlspecialchars("<a href='test'>Test</a>");
echo $new; // <a href='test'>Test</a>
?>
result should be in comment but my result is
<a href='test'>Test</a>
no change. what happen? Help me please....
thank you
htmlspecialchars problem
Moderator: General Moderators
Are you wanting..
Code: Select all
htmlentities();- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
you are displaying the html entity and not parsing the html tag..
If you see <a href='test'>Test</a> as your output, go to view source and you'll see you actually are displaying the html entity, otherwise you'd simply see Test
fyi, htmlentities() is nearly identical to htmlspecialchars()
If you see <a href='test'>Test</a> as your output, go to view source and you'll see you actually are displaying the html entity, otherwise you'd simply see Test
fyi, htmlentities() is nearly identical to htmlspecialchars()