温馨提示×

php mb_stripos 能否处理符号

PHP
小樊
98
2024-12-06 02:54:52
栏目: 编程语言

是的,mb_stripos 函数可以处理符号

例如,如果你想在一个字符串中查找 “example” 这个词,无论它是大写还是小写,你可以这样做:

$string = "This is an Example text with ExAmple words."; $search = "example"; $pos = mb_stripos($string, $search); if ($pos !== false) { echo "Found at position: " . $pos; } else { echo "Not found"; } 

在这个例子中,mb_stripos 会返回 “example” 第一次出现的位置(从 0 开始计数),即 14。

0