如何显示循环播放时显示的次数?
$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)
如何在循环期间打印出这个时间(@abouttoexpire)的时间?
答案 0 :(得分:0)
$i = 0;$j=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) {
$j++;
}
}
}
$i++;
echo 'no_of_times:'.$j;
答案 1 :(得分:0)
试试这个......
{
"firstName":"Paul",
"lastName":"Smith",
"transactionDate":"17/08/2015",
"operationValue":3,
"reason":"Achat nourriture Tim Horton",
"transactionDate":"17/08/2015",
"operationType": "Achon"
}