関数 htmlspecialchars_decode

関数 htmlspecialchars_decode は、 関数 htmlspecialchars の逆の操作を行います。

構文

phphtmlspecialchars_decode(string $string, int $flags = ENT_COMPAT): string

例

タグを含む文字列を変換してみましょう:

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

コードの実行結果:

php'<b>text</b>'

関連項目