PHP strpos()对我来说是大小写敏感的


PHP strpos() IS case sensitive for me

当我使用strpos()时,它是区分大小写的。为什么?这不应该是吗?

PHP v5.3.8

$file_check_result = "%PDF-1.6 %âãÏÓ";
$test = strpos($file_check_result, "pdf");
echo $test;

输出;但是如果我把pdf换成PDFstrpos中它显示了位置。为什么?

stripos是您正在寻找的函数。strpos区分大小写

http://php.net/manual/en/function.stripos.php

不区分大小写的是stripos(注意i):

strpos()   // Finds the position of the first occurrence (case-sensitive)
stripos()  // Finds the position of the first occurrence (case-insensitive)
strrpos()  // Finds the position of the last occurrence (case-sensitive)
strripos() // Finds the position of the last occurrence (case-insensitive)