How to query the coding of variables by php
This article mainly introduces php how to query the coding of variables, the article is very detailed, has a certain reference value, interested friends must read it!
In PHP, you can query the encoding of variables through the mb_detect_encoding function, which detects the encoding of characters, and its syntax is "mb_detect_encoding (string $str, mixed $encoding_list...)".
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
Mb_detect_encoding
(PHP 4 > = 4.0.6, PHP 5, PHP 7, PHP 8)
Mb_detect_encoding-detect the encoding of characters
Description
Mb_detect_encoding (string $str, mixed $encoding_list = mb_detect_order (), bool $strict = false): string
Detects the encoding of the string str.
Parameters.
Str
The string to be checked.
Encoding_list
Encoding_list is a list of character encodings. The encoding order can be specified by an array or a comma-separated list string.
If encoding_list is omitted, detect_order will be used.
Strict
Strict specifies whether to strictly detect the encoding. The default is false.
Return value
Returns false when the character encoding is detected or the encoding of the specified string cannot be detected.
Example
Example # 1 mb_detect_encoding () example
See also
Mb_detect_order ()-sets / gets the detection order of character encodings
The above is all the contents of the article "how to query the Encoding of variables in php". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!