Exemplo n.º 1
0
 /** 
  * Callback helper 
  */
 function chr_utf8_callback($matches)
 {
     return chr_utf8(hexdec($matches[1]));
 }
function html_entity_replace($matches)
{
    if ($matches[2]) {
        return chr_utf8(hexdec($matches[3]));
    } elseif ($matches[1]) {
        return chr_utf8($matches[3]);
    }
    switch ($matches[3]) {
        case "nbsp":
            return chr_utf8(160);
        case "iexcl":
            return chr_utf8(161);
        case "cent":
            return chr_utf8(162);
        case "pound":
            return chr_utf8(163);
        case "curren":
            return chr_utf8(164);
        case "yen":
            return chr_utf8(165);
            //case "eacute" : return chr_utf8(00E9);
            //... etc with all named HTML entities
    }
    return false;
}