Funkcia html_entity_decode
Funkcia html_entity_decode konvertuje
HTML entity na zodpovedajúce znaky.
Pozrite si príklady pre lepšie pochopenie.
Syntax
html_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string
Príklad
Poďme konvertovať reťazec s tagmi:
<?php
$str = '<b>text</b>';
$res = html_entity_decode($str);
echo $res;
?>
Výsledok vykonania kódu:
'<b>text</b>'
Príklad
Poďme konvertovať reťazec s ampersandom:
<?php
$str = 'test: &';
$res = html_entity_decode($str);
echo $res;
?>
Výsledok vykonania kódu:
'test: &'
Pozri tiež
-
funkciu
htmlentities,
ktorá vykonáva opačnú operáciu -
funkciu
htmlspecialchars,
ktorá vykonáva podobnú opačnú operáciu