title: how to get parent array index from multidimensional array in php
body: <p>I have an array $arr.</p>
  
  <p>when I print this it shows the results as follows.</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [name] =&gt; homeandgarden-Control Type
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [1] =&gt; Array
          (
              [name] =&gt; homeandgarden-Depth
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [2] =&gt; Array
          (
              [name] =&gt; homeandgarden-Height
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [3] =&gt; Array
          (
              [name] =&gt; homeandgarden-Load Type
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [4] =&gt; Array
          (
              [name] =&gt; homeandgarden-Machine Type
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [5] =&gt; Array
          (
              [name] =&gt; homeandgarden-Type
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [6] =&gt; Array
          (
              [name] =&gt; homeandgarden-Width
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [7] =&gt; Array
          (
              [name] =&gt; computer &amp; ele
              [label] =&gt; 
              [singular_label] =&gt; 
              [hierarchical] =&gt; 1
              [show_ui] =&gt; 1
              [query_var] =&gt; 1
              [rewrite] =&gt; 1
              [rewrite_slug] =&gt; 
              [0] =&gt; Array
                  (
                      [search_items] =&gt; 
                      [popular_items] =&gt; 
                      [all_items] =&gt; 
                      [parent_item] =&gt; 
                      [parent_item_colon] =&gt; 
                      [edit_item] =&gt; 
                      [update_item] =&gt; 
                      [add_new_item] =&gt; 
                      [new_item_name] =&gt; 
                      [separate_items_with_commas] =&gt; 
                      [add_or_remove_items] =&gt; 
                      [choose_from_most_used] =&gt; 
                  )
  
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [8] =&gt; Array
          (
              [name] =&gt; computer
              [label] =&gt; 
              [singular_label] =&gt; 
              [hierarchical] =&gt; 1
              [show_ui] =&gt; 1
              [query_var] =&gt; 1
              [rewrite] =&gt; 1
              [rewrite_slug] =&gt; 
              [0] =&gt; Array
                  (
                      [search_items] =&gt; 
                      [popular_items] =&gt; 
                      [all_items] =&gt; 
                      [parent_item] =&gt; 
                      [parent_item_colon] =&gt; 
                      [edit_item] =&gt; 
                      [update_item] =&gt; 
                      [add_new_item] =&gt; 
                      [new_item_name] =&gt; 
                      [separate_items_with_commas] =&gt; 
                      [add_or_remove_items] =&gt; 
                      [choose_from_most_used] =&gt; 
                  )
  
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [9] =&gt; Array
          (
              [name] =&gt; homeandgardenairconditioner-Type
              [label] =&gt; 
              [singular_label] =&gt; 
              [hierarchical] =&gt; 1
              [show_ui] =&gt; 1
              [query_var] =&gt; 1
              [rewrite] =&gt; 1
              [rewrite_slug] =&gt; 
              [0] =&gt; Array
                  (
                      [search_items] =&gt; 
                      [popular_items] =&gt; 
                      [all_items] =&gt; 
                      [parent_item] =&gt; 
                      [parent_item_colon] =&gt; 
                      [edit_item] =&gt; 
                      [update_item] =&gt; 
                      [add_new_item] =&gt; 
                      [new_item_name] =&gt; 
                      [separate_items_with_commas] =&gt; 
                      [add_or_remove_items] =&gt; 
                      [choose_from_most_used] =&gt; 
                  )
  
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  
      [10] =&gt; Array
          (
              [name] =&gt; homeandgardendishwasher-Control Type
              [label] =&gt; 
              [singular_label] =&gt; 
              [hierarchical] =&gt; 1
              [show_ui] =&gt; 1
              [query_var] =&gt; 1
              [rewrite] =&gt; 1
              [rewrite_slug] =&gt; 
              [0] =&gt; Array
                  (
                      [search_items] =&gt; 
                      [popular_items] =&gt; 
                      [all_items] =&gt; 
                      [parent_item] =&gt; 
                      [parent_item_colon] =&gt; 
                      [edit_item] =&gt; 
                      [update_item] =&gt; 
                      [add_new_item] =&gt; 
                      [new_item_name] =&gt; 
                      [separate_items_with_commas] =&gt; 
                      [add_or_remove_items] =&gt; 
                      [choose_from_most_used] =&gt; 
                  )
  
              [1] =&gt; Array
                  (
                      [0] =&gt; product
                  )
  
          )
  )
  </code></pre>
  
  <p>and I have a variable $categ.For example $categ = "<strong>homeandgardenairconditioner-Type</strong>"
  then I want to know the index of the parent array whose "<strong>name</strong>" is "<strong>homeandgardenairconditioner-Type</strong>" </p>
  
  <p>i.e --- o/p should be 9</p>
  
  <p>how to get this index. Please help me</p>
  
  <p>Thanks</p>