【发布时间】:2015-08-18 12:25:51
【问题描述】:
如何显示循环时一个句子显示了多少次?
$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) 在循环期间的累积时间?
【问题讨论】: