Funkcja html_entity_decode

Funkcja html_entity_decode konwertuje encje HTML na odpowiadające im symbole. Zobacz przykłady dla lepszego zrozumienia.

Składnia

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

Przykład

Przekonwertujmy ciąg znaków z tagami:

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

Wynik wykonania kodu:

php'<b>text</b>'

Przykład

Przekonwertujmy ciąg znaków z ampersandem:

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

Wynik wykonania kodu:

php'test: &'

Zobacz także