Encoding HTML Entities in a String in PHP


Convert applicable characters to HTML entities with htmlentities() to prevent XSS attacks.

Source Code

$str = "alert('XSS');";
echo htmlentities($str);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments