I have a loop like this:
foreach ($result_new as $count){
echo "<pre>"; print_r($count);
}
This is what is produced:
Array
(
[0] => Array
(
[0] => TomVanhecker
[1] => PASS
[2] => Array
(
[0] => Array
(
)
)
)
)
Array
(
[0] => Array
(
[0] => DonLay
[1] => PASS
[2] => Array
(
[0] => Array
(
[0] => ADDRESS CHECK FAILED
)
)
)
)
Array
(
[0] => Array
(
[0] => PetraBerumen
[1] => REVIEW
[2] => Array
(
[0] => Array
(
[0] => ADDRESS CHECK FAILED
)
)
)
[1] => Array
(
[0] => PetraBerumen
[1] => REVIEW
[2] => Array
(
[0] => Array
(
[0] => ADDRESS CHECK FAILED
)
)
)
[2] => Array
(
[0] => PetraBerumen
[1] => REVIEW
[2] => Array
(
[0] => Array
(
[0] => ADDRESS CHECK FAILED
)
)
)
)
What I need it to find out how many times "ADDRESS CHECK FAILED" appears in each iteration and then do a comparison. I have tried this:
foreach ($result_new as $count){
if ((in_array_r("ADDRESS CHECK FAILED", $count)) ){
$address++
}
if($address > 2){
echo "There was more than two address failures for this customer";
}
The problem is that the $address value continues to increment with each loop but I just want that loops current total.