PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I convert relevant characters in a string to HTML entities?


Use the htmlentities function like this:

<?php
$mystring 
"I said <ignore me then!>you <b>are a little bit</b> whack!";
echo 
htmlentities($mystring);
?>


Run it and see what happens!



More strings PHP Questions

How do I print text to the screen?
How do I make sure a string is a certain length?
How do I display newline characters on a webpage?
How can I remove trailing space from a string?
How do I extract the values of variables from a string?