Bu işlev 2 eşleşme ile sonuçlansa da 6 eşleşme ile sonuçlanır. Burada ne yapıyorum emin değilim.strpos()
public function displayPrize() {
$testString = "The cow jumped over the moon";
$userString = "The cow";
$magicArray = (explode(" ", $testString));
foreach ($magicArray as $value) {
if (strpos(" ", $userString, $value) !== false) {
$count++;
}
}
echo $count . ' matches';
}
$ değer bir dize ... strpos param 3 sayı ... – DragonYen
olmasını bekler Dizi aramasını kullan – devpro
Yapmaya çalıştığınız net değil. Neden 2 maçta sonuçlanması gerektiğini düşünüyorsunuz? Strpos() 'ın yapması gerekenleri ne bekliyorsunuz? – Barmar