ฟังก์ชัน mb_eregi (multibyte regular expression ignore) ใน PHP ใช้ ignore regular expression match ด้วย multibyte support ฟังก์ชันนี้ทำ case-insensitive regular expression match พร้อม multibyte support
Syntax
bool mb_eregi( $str_pattern, $str_string, $arr_matches=null )
ตัวอย่าง:
(pattern = "or", string = "Hello World");
Parameters
mb_eregi() รับ 3 พารามิเตอร์:
pattern – pattern ที่จะ match ใน string ที่กำหนด
mb_ereg ("or", "Hello World") // "or" เป็น pattern ที่จะ match ใน string "Hello World"
string – string ที่จะค้นหา
matches – parameter matches เรียกหลังหา substring ของ pattern จาก string อื่น matches จะเก็บใน array elements ของ matches หากไม่เจอ matches จะคืนค่า empty array
Return Values
ตรวจสอบว่า pattern match ใน string หรือไม่ หาก match คืนค่า integer "1"
ตัวอย่าง
<?php
// UTF-8 encoding
$encoding = mb_regex_encoding("UTF-8");
// String pattern "or" และ string "Hello World"
$integer = mb_ereg ("or","Hello World");
// Output
var_dump($encoding);
print_r($integer);
?>
Output
bool(true) 1