Friday, July 13

Call to undefined function: html_entity_decode

If you are using php version below than 4.3, html_entity_decode it's not available for this version. Then you should employ this lines of codes to make it works

function html_entity_decode ($string, $opt = ENT_COMPAT) {

$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);

if (
$opt & 1) { // Translating single quotes

// Add single quote to translation table;
// doesn't appear to be there by default
$trans_tbl["'"] = "'";
}

if (!(
$opt & 2)) { // Not translating double quotes

// Remove double quote from translation table
unset($trans_tbl["""]);
}

return
strtr ($string, $trans_tbl);
}
}

// Just to be safe ;o)
if (!defined("ENT_COMPAT")) define("ENT_COMPAT", 2);
if (!
defined("ENT_NOQUOTES")) define("ENT_NOQUOTES", 0);
if (!
defined("ENT_QUOTES")) define("ENT_QUOTES", 3);

This will saves your time

No comments: