title: How to loop over associative array using foreach loop construct in following scenairo?
body: <p>I've an array titled <code>$rebate_by_product</code>:</p>
  
  <pre><code>Array
  (
      [op] =&gt; preview
      [id] =&gt; 
      [form_submitted] =&gt; yes
      [company_id] =&gt; 46
      [1] =&gt; Array
          (
              [pack] =&gt; 10
              [quantity] =&gt; 20
              [volume] =&gt; 30
              [units] =&gt; 9
              [amount] =&gt; 40
              [rebate_start_date] =&gt; 2014-05-01
              [rebate_expiry_date] =&gt; 2014-05-05
              [applicable_states] =&gt; Array
                  (
                      [0] =&gt; 1
                      [1] =&gt; 2
                      [2] =&gt; 3
                  )
  
              [rebate_total_count] =&gt; 5000
              [products] =&gt; Array
                  (
                      [1] =&gt; 9
                      [2] =&gt; 10
                  )
  
          )
  
      [2] =&gt; Array
          (
              [pack] =&gt; 50
              [quantity] =&gt; 60
              [volume] =&gt; 70
              [units] =&gt; 10
              [amount] =&gt; 80
              [rebate_start_date] =&gt; 2014-05-06
              [rebate_expiry_date] =&gt; 2014-05-10
              [applicable_states] =&gt; Array
                  (
                      [0] =&gt; 14
                      [1] =&gt; 15
                      [2] =&gt; 16
                  )
  
              [rebate_total_count] =&gt; 10000
              [products] =&gt; Array
                  (
                      [1] =&gt; 11
                      [2] =&gt; 8
                  )
  
          )
  
      [3] =&gt; Array
          (
              [pack] =&gt; 100
              [quantity] =&gt; 200
              [volume] =&gt; 300
              [units] =&gt; 7
              [amount] =&gt; 400
              [rebate_start_date] =&gt; 2014-05-21
              [rebate_expiry_date] =&gt; 2014-05-30
              [applicable_states] =&gt; Array
                  (
                      [0] =&gt; 26
                      [1] =&gt; 33
                      [2] =&gt; 42
                  )
  
              [rebate_total_count] =&gt; 9999
              [products] =&gt; Array
                  (
                      [1] =&gt; 9
                      [2] =&gt; 8
                  )
  
          )
  
      [multiselect] =&gt; 42
  )
  </code></pre>
  
  <p>You can observe from above array that it has few elements which are not array but it has three such elements which are themselves array and even few of its data elements are also arrays so how to loop over this kind of array using foreach loop?</p>