05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

For example:<br />

$string = htmlentities("Einstürzende Neubauten");<br />

echo $string;<br />

Einst&uuml;rzende Neubauten<br />

The entity-escaped version (&uuml;) correctly displays as ü in the web page. As you<br />

can see, the space has not been turned into &nbsp;.<br />

The htmlentities( ) function actually takes up to three arguments:<br />

$output = htmlentities(input, quote_style, charset);<br />

The charset parameter, if given, identifies the character set. The default is “ISO-<br />

8859-1”. The quote_style parameter controls whether single and double quotes are<br />

turned into their entity forms. ENT_COMPAT (the default) converts only double quotes,<br />

ENT_QUOTES converts both types of quotes, and ENT_NOQUOTES converts neither. There<br />

is no option to convert only single quotes. For example:<br />

$input =

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!