関数 html_entity_decode
関数 html_entity_decode は、
HTMLエンティティを対応する文字に変換します。
理解を深めるために例を参照してください。
構文
html_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string
例
タグを含む文字列を変換してみましょう:
<?php
$str = '<b>text</b>';
$res = html_entity_decode($str);
echo $res;
?>
コード実行結果:
'<b>text</b>'
例
アンパサンドを含む文字列を変換してみましょう:
<?php
$str = 'test: &';
$res = html_entity_decode($str);
echo $res;
?>
コード実行結果:
'test: &'
関連項目
-
逆の操作を行う関数
htmlentities、
-
同様の逆の操作を行う関数
htmlspecialchars、