針が干し草の中に現れる回数を見つける必要があります。私は一緒に次のコードを入れてきました。この時点まで:干し草の中の針の数を確認
<?php
$haystack = 'http://www.google.com';
$needle = 'a';
$contents = file_get_contents($haystack);
?>
を私は回「A」(針)の数を見つけたい$内容(干し草の山 - google.comのソースコードを)で表示されます。
は
針が干し草の中に現れる回数を見つける必要があります。私は一緒に次のコードを入れてきました。この時点まで:干し草の中の針の数を確認
<?php
$haystack = 'http://www.google.com';
$needle = 'a';
$contents = file_get_contents($haystack);
?>
を私は回「A」(針)の数を見つけたい$内容(干し草の山 - google.comのソースコードを)で表示されます。
は
substr_count
は、あなたが探しているものです、ありがとうございました。
私は、出力は出力が6 ... トランスパナマバナナ2.
です... http://cscircles.cemc.uwaterloo.ca/8-remix/
needle = 'sses'
haystack = 'assesses'
count = 0
if needle in haystack:
index = haystack.index(needle)
string1 = haystack[index:len(needle) + index]
for position in range(0,len(haystack)):
if haystack[position:len(needle) + position] == string1:
count += 1
print (count)
でオンラインCSCウォータールーコースのため、このまったく同じ質問に答え
O ニューモノウルトラマイクロスコーピックシリコヴォルケーノコニオシスのために...出力は9
です
本当に、ありがとう:) – user1298923