Convert some characters to HTML entities: in PHP
Description
The following code shows how to convert some characters to HTML entities:.
Example
/* w w w.j av a 2 s . co m*/
<?php
$str = "XML & 'CSS'";
echo htmlentities($str, ENT_COMPAT); // Will only convert double quotes
echo "<br>";
echo htmlentities($str, ENT_QUOTES); // Converts double and single quotes
echo "<br>";
echo htmlentities($str, ENT_NOQUOTES); // Does not convert any quotes
?>
The code above generates the following result.