- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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