title: create a simple two dimensinal array from unknown depth array
body: <p>I have unknown depth of array but i want to make simple two dimensional array as following , earlier i think my question doesn't make exact sense so i edited this , please help</p>
  
  <pre><code>private function arrayDepth($a) {
  $arr = array();
  foreach ($a as $key =&gt; $val) {
      if (is_array($val)) {
          $this-&gt;arrayDepth($val);
       }
          else  {           
              $arr[] = $a;
          }           
      }       
  
  } 
  </code></pre>
  
  <p>my current array is </p>
  
  <pre><code> Array
  (
  [0] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [0] =&gt; 41
                  [uid] =&gt; 41
                  [1] =&gt; 16
                  [pid] =&gt; 16
                  [2] =&gt; 30
                  [oid] =&gt; 30
                  [3] =&gt; 1
                  [value] =&gt; 1
                  [4] =&gt; 0
                  [optval] =&gt; 0
                  [5] =&gt; 2014-05-26 16:41:31
                  [updateDate] =&gt; 2014-05-26 16:41:31
              )
  
          [1] =&gt; Array
              (
                  [0] =&gt; Array
                      (
                          [0] =&gt; 42
                          [uid] =&gt; 42
                          [1] =&gt; 16
                          [pid] =&gt; 16
                          [2] =&gt; 31
                          [oid] =&gt; 31
                          [3] =&gt; 1
                          [value] =&gt; 1
                          [4] =&gt; 0
                          [optval] =&gt; 0
                          [5] =&gt; 2014-05-26 16:45:49
                          [updateDate] =&gt; 2014-05-26 16:45:49
                      )
  
                  [1] =&gt; Array
                      (
                          [0] =&gt; 44
                          [uid] =&gt; 44
                          [1] =&gt; 16
                          [pid] =&gt; 16
                          [2] =&gt; 31
                          [oid] =&gt; 31
                          [3] =&gt; 1
                          [value] =&gt; 1
                          [4] =&gt; 0
                          [optval] =&gt; 0
                          [5] =&gt; 2014-05-26 16:42:01
                          [updateDate] =&gt; 2014-05-26 16:42:01
                      )
  
                  [2] =&gt; Array
                      (
                          [0] =&gt; 47
                          [uid] =&gt; 47
                          [1] =&gt; 16
                          [pid] =&gt; 16
                          [2] =&gt; 31
                          [oid] =&gt; 31
                          [3] =&gt; 1
                          [value] =&gt; 1
                          [4] =&gt; 0
                          [optval] =&gt; 0
                          [5] =&gt; 2014-05-26 16:45:19
                          [updateDate] =&gt; 2014-05-26 16:45:19
                      )
  
                  [3] =&gt; Array
                      (
                          [0] =&gt; Array
                              (
                                  [0] =&gt; 51
                                  [uid] =&gt; 51
                                  [1] =&gt; 16
                                  [pid] =&gt; 16
                                  [2] =&gt; 32
                                  [oid] =&gt; 32
                                  [3] =&gt; 1
                                  [value] =&gt; 1
                                  [4] =&gt; 0
                                  [optval] =&gt; 0
                                  [5] =&gt; 2014-05-26 16:47:27
                                  [updateDate] =&gt; 2014-05-26 16:47:27
                              )
  
                      )
  
              )
  
      )
  </code></pre>
  
  <p>) </p>
  
  <p>i need my output like all array which contain some  value into a single array like </p>
  
  <pre><code>array(
       [0] =&gt; Array
              (
                  [0] =&gt; 41
                  [uid] =&gt; 41
                  [1] =&gt; 16
                  [pid] =&gt; 16
                  [2] =&gt; 30
                  [oid] =&gt; 30
                  [3] =&gt; 1
                  [value] =&gt; 1
                  [4] =&gt; 0
                  [optval] =&gt; 0
                  [5] =&gt; 2014-05-26 16:41:31
                  [updateDate] =&gt; 2014-05-26 16:41:31
              )
              [1] =&gt; Array
                      (
                          [0] =&gt; 42
                          [uid] =&gt; 42
                          [1] =&gt; 16
                          [pid] =&gt; 16
                          [2] =&gt; 31
                          [oid] =&gt; 31
                          [3] =&gt; 1
                          [value] =&gt; 1
                          [4] =&gt; 0
                          [optval] =&gt; 0
                          [5] =&gt; 2014-05-26 16:45:49
                          [updateDate] =&gt; 2014-05-26 16:45:49
                      )
  
                  [2] =&gt; Array
                      (
                          [0] =&gt; 44
                          [uid] =&gt; 44
                          [1] =&gt; 16
                          [pid] =&gt; 16
                          [2] =&gt; 31
                          [oid] =&gt; 31
                          [3] =&gt; 1
                          [value] =&gt; 1
                          [4] =&gt; 0
                          [optval] =&gt; 0
                          [5] =&gt; 2014-05-26 16:42:01
                          [updateDate] =&gt; 2014-05-26 16:42:01
                      )   ...... and so on  .....
  </code></pre>