get_html_translation_table

(PHP 4 )

get_html_translation_table --  htmlspecialchars()htmlentities()에 사용된 translation 테이블을 반환한다.

설명

string get_html_translation_table ( int table [, int quote_style])

get_html_translation_table()htmlspecialchars()htmlentities()에 내부적으로 사용된 translation 테이블을 반환한다. 여러분이 원하는 테이블을 지정할 수 있도록 두가지 새로운 정의(HTML_ENTITIES, HTML_SPECIALCHARS)가 있다. 그리고 htmlspecialchars()htmlentities() 함수에서와 마찬가지로, 선택적으로 당신이 사용하는 quote_style을 지정할 수 있다. 기본은 ENT_COMPAT 모드이며, htmlspecialchars()에 설명되어 있는 모드를 참고하기 바란다.

예 1. Translation 테이블 예

$trans = get_html_translation_table (HTML_ENTITIES);

$str = "Hallo & <Frau> & Krämer";

$encoded = strtr ($str, $trans);
$encoded 의 값은 다음과 같다.: "Hallo &amp; &lt;Frau&gt; &amp; Kr&auml;mer".

새로운 방법은 역번역을 하기 위해 array_flip()을 사용하는 것이다.

$trans = array_flip ($trans);

$original = strtr ($str, $trans);

The content of $original would be: "Hallo & <Frau> & Krämer".

참고: 이 함수는 PHP 4.0 에서 추가되었다.

다음을 참고하라 : htmlspecialchars(), htmlentities(), strtr(), 그리고 array_flip().