Funksioni html_entity_decode

Funksioni html_entity_decode konverton entitetet HTML në simbolet përkatëse. Shikoni shembujt për një kuptim më të mirë.

Sintaksa

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

Shembull

Le të konvertojmë një varg me etiketa:

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

Rezultati i ekzekutimit të kodit:

php'<b>text</b>'

Shembull

Le të konvertojmë një varg me ampersand:

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

Rezultati i ekzekutimit të kodit:

php'test: &'

Shihni gjithashtu

  • funksionin htmlentities,
    i cili kryen operacionin e kundërt
  • funksionin htmlspecialchars,
    i cili kryen një operacion të kundërt të ngjashëm