 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
Advertisements
 