Array loop judgment php array
There are five arrays (currently, only three groups are listed, and the obtained arrays are arrays of less than five ):
Array (
0 => array ("oldyear" => "10", "powerFlag" => "1", "powerCredit" => "not good "),
1 => array ("oldyear" => "30", "powerFlag" => "0", "powerCredit" => "Good "),
2 => array ("oldyear" => "80", "powerFlag" => "1", "powerCredit" => "Good ")
.....
)
/*
// Oldyear age
// Whether the powerFlag is signed
// PowerFlag credit
// Credit: If any of the five right holders does not select a good credit condition, the fee is automatically shown as 2.0
// Elderly: if one of the five rights holders selects the elderly or minor (<18 is minor,> 60 is elderly), the failure is automatically displayed.
// Present signature: if either of the five rights holders chooses to sign the event (the number can be 1, and the number cannot be 0), the event fails to be displayed automatically.
I have been thinking for a long time. thank you. thank you very much!
Reply to discussion (solution)
Array ("oldyear" => "10", "powerFlag" => "1", "powerCredit" => "not good "), 1 => array ("oldyear" => "30", "powerFlag" => "0", "powerCredit" => "Good "), 2 => array ("oldyear" => "80", "powerFlag" => "1", "powerCredit" => "Good"); $ find = false; foreach ($ array as $ row) {if ($ row ["oldyear"]> 60 | $ row ["oldyear"] <18) {$ find = true; // elderly: if one of the five rights holders chooses the elderly or minors (<18 is minor,> 60 is elderly ), automatic display failed} if ($ row ["powerFlag"] = '0') {$ find = true; // arrival signature: 5 The right holder cannot sign the website if any one of them has chosen (the number can be 1, and the number cannot be 0 ), auto show failed} if ($ row ["powerCredit"] = 'Bad ') {$ find = true; // credit status: none of the five rights holders have chosen a good credit rating.} if ($ find = false) {echo '2. 0'; // automatically displayed as 2.0} else {// Others}?>