Glossary Term
mb_detect_encoding()
mb_detect_encoding() — Detect character encoding.
mb_detect_encoding() — Detects the most likely character encoding for string string from a list of candidates.
As of PHP 8.1 this function uses heuristics to detect which of the valid text encodings in the specified list is most likely to be correct and may not be in order of encodings provided.
Automatic detection of the intended character encoding can never be entirely reliable; without some additional information, it is similar to decoding an encrypted string without the key. It is always preferable to use an indication of character encoding stored or transmitted with the data, such as a “Content-Type” HTTP header.
Inputs: string: The string being inspected. encodings: A list of character encodings to try. The list may be specified as an array of strings, or a single string separated by commas. If encodings is omitted or null, the current detect_order (set with the mbstring.detect_order configuration option, or mb_detect_order function) will be used. strict: Controls the behaviour when string is not valid in any of the listed encodings. If strict is set to false, the closest matching encoding will be returned; if strict is set to true, false will be returned. The default value for strict can be set with the mbstring.strict_detection configuration option.
Returns: The detected character encoding, or false if the string is not valid in any of the listed encodings.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
