Created
August 5, 2017 05:35
-
-
Save ryuchan00/c8412d38ce8d14c53fb458777cab20b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// mbstrposの誤判定 | |
$keyword2 = 'DEF'; | |
$text2 = 'DEFghi'; | |
// 含まれていないと判定される | |
// mb_strposの戻り値が'0'の場合、誤判定するため | |
// mb_strposの判定は'==='で行うこと | |
if (mb_strpos($text2, $keyword2) == false) { | |
echo $keyword2 . "は含まれていません" . "\n"; | |
echo mb_strpos($text2, $keyword2) . "文字目" . "\n"; | |
} else { | |
echo $keyword2 . "は含まれています" . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment