PHP mb_convert_variables Use

Source: Internet
Author: User

Mb_convert_variables
  • (PHP 4 >= 4.0.6, PHP 5, PHP 7)
  • Mb_convert_variables-convert character code in variable (s)
  • mb_convert_variables-converting the character encoding of one or more variables
Description
string mb_convert_variables  Span class= "OT" > ( string  $to _encoding   mixed  $from _encoding   mixed & $vars  [,  mixed &$   )  //converts character encoding of variables VARs In encoding from_encoding to encoding to_encoding.  //converts the encoding of the variable VARs from from_encoding to encoding to_encoding.  //mb_convert_variables () join strings in Array or Object to detect encoding, since encoding detect Ion tends to fail for short strings. Therefore, it is impossible to mix encoding in a single array or object.  //mb_convert_variables () will stitch the variable array or the string in the object to detect the encoding, because the detection of short strings often fails. Therefore, you cannot mix encodings in an array or an object. 
Parametersto_encoding
    • The encoding the string is being converted to.
    • Converts a string into this encoding.
From_encoding
    • From_encoding is specified as a array or comma separated string, it tries to detect encoding from from-coding. When From_encoding was omitted, Detect_order is used.
    • From_encoding can be specified as an array or a comma-delimited string, which attempts to detect the encoding based on from-coding. When From_encoding is omitted, the Detect_order is used.
VARs
    • VARs is the reference to the variable being converted. String, Array and Object are accepted. Mb_convert_variables () assumes all parameters has the same encoding.
    • VARs is a reference to the variable to be converted. Parameters can accept the type of String, Array, and Object. Mb_convert_variables () assumes that all parameters have the same encoding.
...
    • Additional VARs.
    • The extra VARs.
Return Values
    • The character encoding before conversion for success, or FALSE for failure.
    • On success, returns the character encoding before the conversion, and FALSE on failure.
Examples
<?php/*** Created by Phpstorm.* User:zhang* Date:2018/1/29* time:16:29 *//* Convert variable $post 1, $post 2 encoded as internal (internal) encoding * /$post 1="Hello";$post 2="China";Echo $post 2.Php_eol;$interenc=mb_internal_encoding();Echo $interenc.Php_eol;$inputenc=Mb_convert_variables( $interenc,    "Ascii,utf-8,sjis-win",    $post 1,    $post 2 );if ( $inputenc ){Echo $post 1.Php_eol;    Echo $post 2.Php_eol;}
Article reference
    • http://php.net/manual/en/function.mb-convert-variables.php
Reprint Annotated Source

PHP mb_convert_variables Use

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.