-3

使用strpos()する場合、大文字と小文字が区別されます。なんで?そうじゃないの?

PHP v5.3.8

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

何も出力しません。ただし、に変更pdfすると位置が表示さPDFstrposます。なんで?

4

2 に答える 2

15

striposあなたが探している機能です。strpos大文字と小文字が区別されます

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

于 2011-11-07T21:01:14.827 に答える
4

大文字と小文字を区別しないものは次のとおりです( istriposに注意してください)。

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)
于 2016-01-13T08:16:40.673 に答える