Funkcija html_entity_decode

Funkcija html_entity_decode pretvori HTML entitete v ustrezne simbole. Oglejte si primere za boljše razumevanje.

Sintaksa

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

Primer

Pretvorimo niz z oznakami:

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

Rezultat izvajanja kode:

php'<b>text</b>'

Primer

Pretvorimo niz z ampersandom:

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

Rezultat izvajanja kode:

php'test: &'

Glejte tudi