Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:29:16+00:00 2026-06-16T00:29:16+00:00

I have a array called $menu_array ; and currently looks like this [0] =>

  • 0

I have a array called $menu_array; and currently looks like this

   [0] => Array
    (
        [id_parent_menu] => 4
        [parent_info] => test
        [children_menu] => Array
            (
                [0] => Array
                    (
                        [id_child_menu] => 21
                        [children_info] => test
                    )

                [1] => Array
                    (
                        [id_child_menu] => 22
                        [children_info] => test2.
                    )

            )

    )

and so on.

I also have another array $access that looks like this:

     array(
          [4]='true'
          [22]='true'
     ) 

What I’m trying to do is check to see if the key for the $access array exists as a id_parent_menu, and then put a key and value of

$menu_array[can_view]='true';

Then, also check if inside the $children_menu array inside of the $menu_array if the a $access key exists as a id_child_menu and set a value of can_view = true in there too.

$menu_array['children_menu'][1]['can_view']='true';
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:29:17+00:00Added an answer on June 16, 2026 at 12:29 am
    foreach ($menu_array as $key => $value){
      if(isset($access[$value['id_parent_menu']]) && $access[$value['id_parent_menu']])
      {
        $menu_array[$key]['can_view']=true;
    
        foreach($value['children_menu']  as $key2 => $value2)
          if(isset($access[$value2['id_child_menu']]) && $access[$value2['id_child_menu']])
             $menu_array[$key]['children_menu'][$key2]['can_view']=true;
      }
    
    }
    

    (A child item can be visible only if the parent item is visible.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-dimensional array right now that looks like this: function art_appreciation_feeds() {
I have an array of sprites called segments and I would like to skip
I have the following array of structures called test, where each field is a
I have this array called $addon_array , that when i use var_dump shows up
So I have some array called params[]; there are things like a[0] = 2
I have an array called: $fragment = array($fragment); Which has the following three values:
I have an array called $times . It is a list of small numbers
I have a pretty simple problem. Basically I have an array called $list that
I have a large array called data. At the 10th array position i have
I have a struct array called AnalysisResults , that may contain any MATLAB datatypes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.