Posted
Filed under PHP
[원문]:
http://www.umbrellastudio.com/web-development/php4-friendly-htmlspecialchars_decode/

[php 4.4.x] 즉 5버전 이하 버전에서는 htmlspecialchars는 존재 하지만
htmlspecialchars_decode함수는 5버전 부터 존재 한다. 그래서 다음과 같이 php 4버전 에서 사용 할 수 있는 함수 입니다.


if ( !function_exists('htmlspecialchars_decode') ){
    function htmlspecialchars_decode($string,$style=ENT_COMPAT)
    {
        $translation = array_flip(get_html_translation_table(HTML_SPECIALCHARS,$style));
        if($style === ENT_QUOTES){ $translation['''] = '\''; }
        return strtr($string,$translation);
    }
}
2013/12/14 22:29 2013/12/14 22:29