String function Library: get_html_translation_table

Source: Internet
Author: User
Keywords get_html_translation_table php Chinese Function Handbook
Tags aliyun array_flip function function library get_html_translation_table html htmlentities htmlspecialchars

Get_html_translation_table

(PHP4 >= 4.0b4)

Get_html_translation_table---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Returns the conversion table used by Htmlspecialchars () and Htmlentities ()

Syntax: string get_html_translation_table (int table)

Description:

Get_html_translation_table () will return the conversion table used internally by Htmlspecialchars () and Htmlentities (), which has two new definitions Html_ Datastore and Htmlspecialchars, which allows you to specify the form you want.

Example:

<?php

$trans = get_html_translation_table (html_entities);

$str = "Hallo & <Frau> & kr 鄝 er";

$encoded = Strtr ($str, $trans);

?>

Variable $encoded will include: "Hallo &amp; &lt; Frau&gt; &amp; Kr&auml;mer "

Using Array_flip () can change the direction of transformation

Example:

<?php

$trans = Array_flip ($trans);

$original = Strtr ($str, $trans);

?>

$original content will be: "Hallo & <Frau> & kr 鄝 er"

Note: This function is a new function in PHP4.0

Reference: Htmlspecialchars () htmlentities () Strtr () Array_flip ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.