ฟังก์ชัน mb_stripos() ใน PHP ใช้หาตำแหน่ง first occurrence ของ string ภายในอีก string หนึ่ง เป็น case-insensitive mb_stripos() คืนค่าตำแหน่ง numeric ของ first existence ของ needle ใน haystack ที่กำหนด หากไม่เจอ needle คืนค่า False
Syntax
integer mb_stripos($str_haystack, $str_needle, $int_offset=0, $str_encoding=empty)
Parameters
รับ 4 พารามิเตอร์:
$str_haystack – string ใช้หาตำแหน่ง first existence ของ needle
$str_needle – string ที่จะหาจาก haystack
$int_offset – ค้นหาตำแหน่ง string ใน haystack หาก offset เป็น negative จะนับจากท้าย string
$str_encoding – character encoding name หาก omit จะใช้ internal character encoding
Return Values
คืนค่าตำแหน่ง numeric ของ first existence ของ needle ใน haystack คืนค่า False หากไม่เจอ
Example 1
<?php
mb_internal_encoding("UTF-8");
// using string PHP Tutorials
// offset=0
$string = mb_stripos("PHP Tutorials","ia", 0 );
// output int(9)
var_dump($string);
?>
Output
int(9)