Fungsi html_entity_decode

Fungsi html_entity_decode mengonversi entitas HTML ke simbol yang sesuai. Lihat contoh untuk pemahaman yang lebih baik.

Sintaks

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

Contoh

Mari konversi string dengan tag:

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

Hasil eksekusi kode:

php'<b>text</b>'

Contoh

Mari konversi string dengan ampersand:

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

Hasil eksekusi kode:

php'test: &'

Lihat juga