PHP/HTML/get html translation table

Материал из Web эксперт
Перейти к: навигация, поиск

get html translation table: decode

   <source lang="html4strict">

<?php

  $entities = get_html_translation_table(HTML_ENTITIES);
  $translate = array_flip($entities);
  $string = "é ú";
  echo strtr($string, $translate); 

?>

 </source>
   
  


get_html_translation_table: encode

   <source lang="html4strict">

<?php

  $string = "<>";
  $translate = get_html_translation_table(HTML_ENTITIES);
  echo strtr($string, $translate);

?>

 </source>
   
  


get_html_translation_table() translates text to its HTML equivalent.

   <source lang="html4strict">

Its syntax is: string get_html_translation_table (int table) The two tables that can be specified as input parameters to this function are: HTML_ENTITIES HTML_SPECIALCHARS <?

   $string = "adsf";
   $translate = get_html_translation_table(HTML_ENTITIES);
   print strtr($string, $translate);

?>

 </source>