Funkcja html_entity_decode
Funkcja html_entity_decode konwertuje
encje HTML na odpowiadające im symbole.
Zobacz przykłady dla lepszego zrozumienia.
Składnia
html_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string
Przykład
Przekonwertujmy ciąg znaków z tagami:
<?php
$str = '<b>text</b>';
$res = html_entity_decode($str);
echo $res;
?>
Wynik wykonania kodu:
'<b>text</b>'
Przykład
Przekonwertujmy ciąg znaków z ampersandem:
<?php
$str = 'test: &';
$res = html_entity_decode($str);
echo $res;
?>
Wynik wykonania kodu:
'test: &'
Zobacz także
-
funkcję
htmlentities,
która wykonuje odwrotną operację -
funkcję
htmlspecialchars,
która wykonuje podobną odwrotną operację