如何顯示在循環中顯示sence的次數?在foreach循環中計算strpos適用次數
$i = 0;
foreach ($parts as $new[$i]) {
$abouttoexpire = strpos($new[$i], 'Your Airbnb question is about to expire');
$anairbnbexpert = strpos($new[$i], 'An Airbnb expert is waiting on feedback from you regarding');
$requesttoalter = strpos($new[$i], 'Your request to alter reservation');
//when the message was made
preg_match('/<div class="timestamp"[\s\S]*?>(.*)*?\+0000<\/div>/', $new[$i], $dateofmsg);
//between 9am and 6pm
$hour = date('H', strtotime(@$dateofmsg[1]));
if ($hour >= 9 && $hour <= 18) {
//if we found this sentence
if ($abouttoexpire !== FALSE) {
//how i show here how many times we catch the sentence @abouttoexpire??
}
}
}
$i++;
裏面的條件:if ($abouttoexpire !== FALSE)
如何打印此SENCE(@abouttoexpire)的時間循環期間計提壞賬?
這是給我no_of_times:0 –
爲什麼你需要這樣$ I ++,它的外面foreach..right? –
它是需要的,因爲那裏有3個循環,但即使沒有$我會改變什麼? –