html_entity_decode 함수

html_entity_decode 함수는 HTML 엔티티를 해당 문자로 변환합니다. 더 나은 이해를 위해 예제를 참조하세요.

구문

phphtml_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string

예제

태그가 포함된 문자열을 변환해 봅시다:

php<?php
  $str = '<b>text</b>';
  $res = html_entity_decode($str);
  
  echo $res;
?>

코드 실행 결과:

php'<b>text</b>'

예제

엠퍼샌드(&)가 포함된 문자열을 변환해 봅시다:

php<?php
  $str = 'test: &';
  $res = html_entity_decode($str);
  
  echo $res;
?>

코드 실행 결과:

php'test: &'

함께 보기