Fungsi html_entity_decode

Fungsi html_entity_decode menukar entiti HTML kepada aksara yang sepadan. Lihat contoh untuk pemahaman yang lebih baik.

Sintaks

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

Contoh

Mari tukar rentetan dengan tag:

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

Keputusan pelaksanaan kod:

php'<b>text</b>'

Contoh

Mari tukar rentetan dengan ampersand:

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

Keputusan pelaksanaan kod:

php'test: &'

Lihat juga