ฟังก์ชัน mb_detect_order() ใช้ตั้งค่าหรือดึงลำดับการตรวจจับ character encoding รองรับตั้งแต่ PHP 4.2.0 ขึ้นไป
รูปแบบการใช้งาน (Syntax)
array|bool mb_detect_order(array|string|null $encoding = null)
พารามิเตอร์
- $encoding – encoding detection order เป็น array หรือ comma-separated list หากละเว้นหรือ null จะคืนค่า detection order ปัจจุบันเป็น array
ค่าที่คืนกลับ
เมื่อตั้งค่า detection order คืน true เมื่อสำเร็จ false เมื่อล้มเหลว
ตัวอย่าง
<?php
// ตั้งค่า detection order ด้วย comma-separated list
mb_detect_order("eucjp-win,sjis-win,UTF-8");
// ตั้งค่า detection order ด้วย array
$array[] = "ASCII";
$array[] = "JIS";
$array[] = "EUC-JP";
mb_detect_order($array);
// แสดง detection order ปัจจุบัน
echo implode(", ", mb_detect_order());
?>
ผลลัพธ์
ASCII, JIS, EUC-JP