Free web development scripts for the webmasterDevelopment Scripts


 
 Site Navigation
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 8 users online
 o Most users online: 67
 o Home
  o PHP
   o Tips and Hints
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Designer Baby Clothes
 o Advertise Here Make Money
 o designplace
 o Wedding Vendor Directory
 o OxyScripts
 o Free Wedding Websites
 o Free Online Invoices

Decode HTML Special Entities (Rated 5)

Description:

Convert all HTML entities to their applicable characters.

e.g. & amp; (minus the space) will be converted to &

Code starts here


<?PHP

function decodeHTML($string) {
$string = strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES)));
$string = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $string);
return
$string;
}

?>

Last Edited: November 12, 2005, 12:17 pm


Submitted by Devscripts on 12-11-2005 12:17


Rate This Script

User Contributed Comments

On 29-04-2003 13:17 Devscripts said:

This is very very useful for when you are grabbing a news feed of someones site, as they will be using special entities which might not get converted.


Registered Members login
© Copyright 2003 - Devscripts.net