ฟังก์ชัน mb_get_info() ใช้ดึงการตั้งค่า internal ของ mbstring extension รองรับตั้งแต่ PHP 5.4 ขึ้นไป
รูปแบบการใช้งาน (Syntax)
array|string|int mb_get_info(string $type = "all")
พารามิเตอร์
รับพารามิเตอร์เดียวคือ $type เพื่อระบุข้อมูลที่ต้องการ:
- หากไม่ระบุ หรือระบุ "all" จะคืนค่าข้อมูลทั้งหมด ได้แก่:
"internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character", "strict_detection"
- หากระบุเฉพาะบางรายการ (เช่น "internal_encoding", "http_output", "language" เป็นต้น) จะคืนค่าเฉพาะรายการนั้น
หมายเหตุ: ตั้งแต่ PHP 8.0.0 ไม่รองรับ type "func_overload" และ "func_overload_list" แล้ว
ค่าที่คืนกลับ
คืนค่า array ของข้อมูลตาม type หากไม่ระบุ type คืนค่าเฉพาะ type ที่ระบุ คืน false หากล้มเหลว
ตัวอย่าง
<?php $string = mb_get_info(); print_r($string); ?>
ผลลัพธ์
Array ( [internal_encoding] => UTF-8 [http_output] => UTF-8 [http_output_conv_mimetypes] => ^(text/|application/xhtml\+xml) [mail_charset] => UTF-8 [mail_header_encoding] => BASE64 [mail_body_encoding] => BASE64 [illegal_chars] => 0 [encoding_translation] => Off [language] => neutral [detect_order] => Array ( [0] => ASCII [1] => UTF-8 ) [substitute_character] => 63 [strict_detection] => Off )