
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP – How to set the character encoding detection order using mb_detect_order()?
The mb_detect_order() function in PHP can be used to set/get the character encoding detection in an order. This function is supported in PHP 4.2.0 or higher versions.
Syntax
array|bool mb_detect_order(str $encoding)
Parameters
mb_detect_order() accepts only one parameter $encoding with string, array and bool.
$encoding− This encoding parameter is an array or comma-separated list of character encoding. If it is omitted or null, then it returns the current character encoding detection order as an array.
Return Values
When setting the encoding detection order, it returns True on success or it returns False on failure.
Example
<?php // Set detection order by enumerated list mb_detect_order("eucjp-win,sjis-win,UTF-8"); // Set detection order by array $array[] = "ASCII"; $array[] = "JIS"; $array[] = "EUC-JP"; mb_detect_order($array); // It shows the current detection order echo implode(", ", mb_detect_order()); ?>
Output
ASCII, JIS, EUC-JP
- Related Questions & Answers
- PHP – How to detect character encoding using mb_detect_encoding()
- PHP – Set the current setting for character encoding conversion using iconv_set_encoding() function
- PHP – Get or set the HTTP output character encoding with mb_http_output()
- PHP – Convert a string to a requested character encoding using iconv()
- PHP – Detect HTTP input character encoding with mb_http_input()
- Node.js – Retrieving file character encoding
- PHP – How to get the substitution character using mb_substitute_character()?
- How to set encoding in PHP FPDI library?
- How to include the character encoding in HTML?
- PHP – Get aliases of a known encoding type using mb_encoding_aliases()
- PHP – Check if strings are valid for the specified encoding using mb_check_encoding()
- PHP – How to return the character count of a string using iconv_strlen()?
- PHP – How to return character by Unicode code point value using mb_chr()?
- PHP – How to get the Unicode point value of a given character?
- PHP – How to get or set the path of a domain?
Advertisements