温馨提示×

stripos能否忽略大小写检索

小樊
85
2024-06-28 19:43:27
栏目: 编程语言
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

是的,stripos函数可以忽略大小写进行检索。可以在函数的第三个参数中传入常量值STR_CASE_INSENSITIVE来实现忽略大小写的检索。示例代码如下:

$string = 'Hello, World!';
$pos = stripos($string, 'hello', 0, STR_CASE_INSENSITIVE);
if ($pos !== false) {
    echo 'The word "hello" is found in the string.';
} else {
    echo 'The word "hello" is not found in the string.';
}

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:stripos php 如何忽略大小写

0