How to deal with php double-layer loop control

Source: Internet
Author: User
Php double-layer loop control has two loops, one being (Loop 1) 1, 2, 3 .... n, the other is (loop 2) a, B, c .... z; now you need to make a judgment to determine whether each item of Loop 1 is in loop 2 (if found). my own code is as follows: for ($ i1; $ I ++; I & lt; N) {if ($ ia) | ($ ib) | ($ ic) ($ id ).....) echo found $ I;} feeling low efficiency php double-layer loop control
There are two loops, one being (Loop 1) 1, 2, 3... N, and the other being (loop 2) a, B, c... z;
Now we need to make a judgment to determine whether each item of Loop 1 is in loop 2 (if found). my own code is as follows:
For ($ I = 1; $ I ++; I If ($ I = a) | ($ I = B) | ($ I = c) ($ I = d ).....)
Echo 'found' $ I;
}
I feel inefficient. thank you for your advice. Thank you very much.

------ Solution --------------------
Commonjam (commonjam)
'User posting rate as of 11:25:26 is 0.00%

Post your questions as soon as they are answered.
Http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
Http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
Http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html

8. how do I add and divide messages?
Http://community.csdn.net/help/helpcenter.htm#

------ Solution --------------------
I have already told you that it's not done yet!
For more information, see the manual ..
PHP code
$ Arr1 = array ('F', '1', '2', '3', 'C'); $ arr2 = array ('A', 'B ', 'C', 'D', 'e', 'F', 'g'); foreach ($ arr1 as $ val) {if (in_array ($ val, $ arr2) {echo 'found '. $ val.'
';} Else {echo' not found '. $ val .'
';}}

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.