Questions about array loop judgment

Source: Internet
Author: User
There are five arrays for array loop judgment (currently, only three groups are listed, and the obtained arrays are arrays of less than five): array (0 = & gt; array ("oldyear" & nbsp ;=& gt; & nbsp; "10", "powerFlag" & nbsp ;=& gt; & nbsp; "1 ", "powerCredit" & array loop judgment
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! Php array: array ("oldyear "? =>? "10", "powerFlag "? =>? "1", "powe... 'data-pics =''>
------ Solution --------------------
 $ Array = 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 ")
);
$ Find = false;
Foreach ($ array as $ row ){
If ($ row ["oldyear"]> 60
------ Solution --------------------
$ Row ["oldyear"] <18 ){
$ Find = true; // elderly: if one of the five rights holders selects the elderly or minor (<18 is a minor,> 60 is an elderly), the failure is automatically displayed.
}
If ($ row ["powerFlag"] = '0 '){
$ Find = true; // The on-site signature: if one of the five right holders fails to sign (the on-site signature can be set to 1, and the on-site signature cannot be set to 0), the automatic display fails.
}
If ($ row ["powerCredit"] = 'Bad '){
$ Find = true; // credit condition: the credit condition is good for any of the five right holders who do not select a credit.
}
}
If ($ find = false ){
Echo '2. 0'; // automatically displayed as 2.0
} Else {
// Others
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.