ශ්‍රිතය html_entity_decode

html_entity_decode ශ්‍රිතය HTML ස්වරූප අදාල සංකේත වලට පරිවර්තනය කරයි. වඩා හොඳ අවබෝධයක් සඳහා උදාහරණ බලන්න.

වාක්‍ය රචනා ක්‍රමය

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

උදාහරණය

ටැග සහිත වදන පරිවර්තනය කරමු:

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

කේතය ක්‍රියාත්මක කිරීමේ ප්‍රතිඵලය:

php'<b>text</b>'

උදාහරණය

ඇම්පර්සන්ඩ් සමඟ වදන පරිවර්තනය කරමු:

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

කේතය ක්‍රියාත්මක කිරීමේ ප්‍රතිඵලය:

php'test: &'

මෙයද බලන්න

  • htmlentities ශ්‍රිතය,
    ප්‍රතිවිරුද්ධ මෙහෙයුම සිදු කරයි
  • htmlspecialchars ශ්‍රිතය,
    සමාන ප්‍රතිවිරුද්ධ මෙහෙයුමක් සිදු කරයි