★ wanayoo — archive 1999 http://www.php.net/manual/it/function.get-html-translation-table.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Strings
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageFrench version of this pageHungarian version of this page
Strings
* AddCSlashes
* AddSlashes
* bin2hex
* Chop
* Chr
* chunk_split
* convert_cyr_string
* count_chars
* crypt
* echo
* explode
* flush
* get_html_translation_table
* get_meta_tags
* htmlentities
* htmlspecialchars
* implode
* join
* ltrim
* md5
* Metaphone
* nl2br
* Ord
* parse_str
* print
* printf
* quoted_printable_decode
* QuoteMeta
* rawurldecode
* rawurlencode
* setlocale
* similar_text
* soundex
* sprintf
* strcasecmp
* strchr
* strcmp
* strcspn
* strip_tags
* StripCSlashes
* StripSlashes
* stristr
* strlen
* strpos
* strrchr
* str_repeat
* strrev
* strrpos
* strspn
* strstr
* strtok
* strtolower
* strtoupper
* str_replace
* strtr
* substr
* substr_replace
* trim
* ucfirst
* ucwords
Manual: get_html_translation_table
View the source code for this pageSearch the site



Previous page
 flush
 Updated
Sun, 06 Aug 2000
get_meta_tags 
Next page


get_html_translation_table

(PHP4 >= 4.0b4)

get_html_translation_table --  Returns the translation table used by htmlspecialchars() and htmlentities().

Description

string get_html_translation_table (int table)

get_html_translation_table() will return the translation table that is used internally for htmlspecialchars() and htmlentities(). Ther are two new defines (HTML_ENTITIES, HTML_SPECIALCHARS) that allow you to specify the table you want.

Esempio 1. Translation Table Example


$trans = get_html_translation_table (HTML_ENTITIES);
$str = "Hallo & <Frau> & Krämer";
$encoded = strtr ($str, $trans);
      
The $encoded variable will now contain: "Hallo &amp; &lt;Frau&gt; &amp; Kr&auml;mer".

The cool thing is using array_flip() to change the direction of the translation.


$trans = array_flip ($trans);
$original = strtr ($str, $trans);
      

The content of $original would be: "Hallo & <Frau> & Krämer".

Nota: This function was added in PHP 4.0.

See also: htmlspecialchars(), htmlentities(), strtr(), and array_flip().


User Contributed Notes: get_html_translation_table


tim_converse@excite.com
12-Jul-2000 02:24
Although the return type is given as string, it actually returns an array, suitable for the new version of strtr().


prokosch@aptima.com
04-Aug-2000 12:40
I'm looking for a similar translation table or translation function that will translate a string, eg "System Domain.1", to what PHP would translate a form variable of that name to, eg "System_Domain_1". Does this exist as a function? Thanks...


 About Notes


Previous page
 flush
 Updated
Sun, 06 Aug 2000
get_meta_tags 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.