使用strpos()
する場合、大文字と小文字が区別されます。なんで?そうじゃないの?
PHP v5.3.8
$file_check_result = "%PDF-1.6 %âãÏÓ";
$test = strpos($file_check_result, "pdf");
echo $test;
何も出力しません。ただし、に変更pdf
すると位置が表示さPDF
れstrpos
ます。なんで?
stripos
あなたが探している機能です。strpos
大文字と小文字が区別されます
大文字と小文字を区別しないものは次のとおりです( 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)