How to loop arrays with conditions

Source: Internet
Author: User
How to loop through the array with conditions this post finally by albb_num1 in 2014-10-1820: 47: 12 edit the following array $ abcarray (& nbsp; & nbsp; [navigation_list] & nbsp; & gt; & nbsp; Array & nbsp; & nbs how to loop arrays with conditions

This post was last edited by albb_num1 at 20:47:12

The following array


$ Abc = array (
[Navigation_list] => Array
(
[0] => Array
(
[Navigation_id] => 1
[Navigation_title] => Question 1
[Navigation_link] => http: // 127.0.0.1/
[Navigation_sort] = & gt; 255
[Navigation_open_type] => 1
)

[1] => Array
(
[Navigation_id] => 2
[Navigation_title] => Question 2
[Navigation_link] => http: // 127.0.0.1/circle
[Navigation_sort] = & gt; 255
[Navigation_open_type] => 1
)

[2] => Array
(
[Navigation_id] => 3
[Navigation_title] => Question 3
[Navigation_link] => http: // 127.0.0.1/microshop
[Navigation_sort] = & gt; 255
[Navigation_open_type] => 1
)

[3] => Array
(
[Navigation_id] => 4
[Navigation_title] => Question 4
[Navigation_link] => http: // 127.0.0.1/shop/index. php? Act = brand
[Navigation_sort] = & gt; 255
[Navigation_open_type] => 1
)

)
)

If I want to loop out the next two arrays, that is, the first two are not allowed, how can I write conditions?
The following code is written by me. Why can't we loop it out? what's wrong:


if ($abct[navigation_list][navigation_id]>2 || $output[navigation_list][navigation_id]>5){
foreach($output['navigation_list'] as $value) {?>
  • " >




  • ------ Solution ----------------------
           foreach($abc['navigation_list'] as $value) {?>
    2){ ?>

    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.