W3Schools

home HOME

PHP Basic
PHP HOME
PHP Intro
PHP Install
PHP Syntax
PHP Variables
PHP String
PHP Operators
PHP If...Else
PHP Switch
PHP Arrays
PHP Looping
PHP Functions
PHP Forms
PHP $_GET
PHP $_POST

PHP Advanced
PHP Date
PHP Include
PHP File
PHP File Upload
PHP Cookies
PHP Sessions
PHP E-mail
PHP Secure E-mail
PHP Error
PHP Exception
PHP Filter

PHP Database
MySQL Introduction
MySQL Connect
MySQL Create
MySQL Insert
MySQL Select
MySQL Where
MySQL Order By
MySQL Update
MySQL Delete
PHP ODBC

PHP XML
XML Expat Parser
XML DOM
XML SimpleXML

PHP and AJAX
AJAX Introduction
XMLHttpRequest
AJAX Suggest
AJAX XML
AJAX Database
AJAX responseXML
AJAX Live Search
AJAX RSS Reader
AJAX Poll

PHP Reference
PHP Array
PHP Calendar
PHP Date
PHP Directory
PHP Error
PHP Filesystem
PHP Filter
PHP FTP
PHP HTTP
PHP Libxml
PHP Mail
PHP Math
PHP Misc
PHP MySQL
PHP SimpleXML
PHP String
PHP XML
PHP Zip

PHP Quiz
PHP Quiz

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Forum

Helping W3Schools

PHP get_html_translation_table() Function


PHP String Reference Complete PHP String Reference

Definition and Usage

The get_html_translation_table() function returns the translation table used by the htmlentities() and htmlspecialchars() functions.

Syntax

get_html_translation_table(function,quotestyle)

Parameter Description
function Optional. Specifies which translation table to return. Default is HTML_SPECIALCHARS.

Possible values:

  • HTML_ENTITIES - Translates all characters that need URL-encoding to be shown properly on a HTML page
  • HTML_SPECIALCHARS - Translates some characters that need URL-encoding to be shown properly on a HTML page
quotestyle Optional. Defines how to encode single and double quotes. Default is ENT_COMPAT

Possible values:

  • ENT_COMPAT - Encodes double quotes, not single quotes
  • ENT_QUOTES - Encodes double and single quotes
  • ENT_NOQUOTES - Does not encode single or double quotes


Tips and Notes

Tip: Some characters can be encoded several ways. The get_html_translation_table() function returns the most common encoding.


Example

In this example we will show both translation tables.:

<?php
print_r (get_html_translation_table());
echo "<br />";
print_r (get_html_translation_table(HTML_ENTITIES));
?>

The output of the code above will be:

Array 
( 
["] => " [<] => < [>] => > [&] => & 
) 
Array 
( 
[ ] =>   [¡] => ¡ [¢] => ¢ [£] => £ 
[¤] => ¤ [¥] => ¥ [¦] => ¦ [§] => § 
[¨] => ¨ [©] => © [ª] => ª [«] => « 
[¬] => ¬ [­] => ­ [®] => ® [¯] => ¯ 
[°] => ° [±] => ± [²] => ² [³] => ³ 
[´] => ´ [µ] => µ [¶] => ¶ [·] => · 
[¸] => ¸ [¹] => ¹ [º] => º [»] => » 
[¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿ 
[À] => À [Á] => Á [Â] => Â [Ã] => Ã 
[Ä] => Ä [Å] => Å [Æ] => Æ [Ç] => Ç 
[È] => È [É] => É [Ê] => Ê [Ë] => Ë 
[Ì] => Ì [Í] => Í [Î] => Î [Ï] => Ï 
[Ð] => Ð [Ñ] => Ñ [Ò] => Ò [Ó] => Ó 
[Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => × 
[Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û 
[Ü] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß 
[à] => à [á] => á [â] => â [ã] => ã 
[ä] => ä [å] => å [æ] => æ [ç] => ç 
[è] => è [é] => é [ê] => ê [ë] => ë 
[ì] => ì [í] => í [î] => î [ï] => ï 
[ð] => ð [ñ] => ñ [ò] => ò [ó] => ó 
[ô] => ô [õ] => õ [ö] => ö [÷] => ÷ 
[ø] => ø [ù] => ù [ú] => ú [û] => û 
[ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ 
["] => " [<] => < [>] => > [&] => & 
)


PHP String Reference Complete PHP String Reference


Learn XML with <oXygen/> XML Editor - Free Trial!

oXygen - Probably The World's Best XML Editor   

oXygen helps you learn to define, edit, validate and transform XML documents. Supported technologies include XML Schema, DTD, Relax NG, XSLT, XPath, XQuery, CSS.

Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!

Do you have any XML related questions? Get free answers from the oXygen XML forum and from the video demonstrations.

Download a FREE 30-day trial today!




Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2008 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999