11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

www.it-ebooks.infoCHAPTER 9 • STRINGS AND REGULAR EXPRESSIONSCreating a Customized Conversion ListThe strtr() function converts all characters in a string to their corresponding match found in apredefined array. Its prototype follows:string strtr(string str, array replacements)This example converts the deprecated bold () character to its XHTML equivalent:This returns the following:Today In <strong>PHP</strong>-Powered NewsConverting HTML to Plain TextYou may sometimes need to convert an HTML file to plain text. You can do so using the strip_tags()function, which removes all HTML and <strong>PHP</strong> tags from a string, leaving only the text entities. Itsprototype follows:string strip_tags(string str [, string allowable_tags])The optional allowable_tags parameter allows you to specify which tags you would like to beskipped during this process. This example uses strip_tags() to delete all HTML tags from a string:

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

Saved successfully!

Ooh no, something went wrong!