title: PHP Array issue , mulitple rows generated
body: <p>I have an array that is fetched from database using some <code>bindModel</code> in cakephp.
  finally now I want to change its format according to my liking to own.
  here is the array contains. </p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [DriverLocation] =&gt; Array
                  (
                      [id] =&gt; 1
                      [dispensary_id] =&gt; 1
                      [driver_id] =&gt; 85
                      [zip_code_id] =&gt; 42
                      [created] =&gt; 2015-05-25 12:01:14
                  )
  
              [ZipCode] =&gt; Array
                  (
                      [id] =&gt; 42
                      [province_id] =&gt; 3846
                      [city] =&gt; Rohtak
                      [zip_code] =&gt; 30215
                      [status] =&gt; active
                  )
  
              [UserProfile] =&gt; Array
                  (
                      [first_name] =&gt; Arman
                      [last_name] =&gt; Kumar
                  )
  
          )
  
      [1] =&gt; Array
          (
              [DriverLocation] =&gt; Array
                  (
                      [id] =&gt; 2
                      [dispensary_id] =&gt; 1
                      [driver_id] =&gt; 85
                      [zip_code_id] =&gt; 43
                      [created] =&gt; 2015-05-25 12:01:14
                  )
  
              [ZipCode] =&gt; Array
                  (
                      [id] =&gt; 43
                      [province_id] =&gt; 3846
                      [city] =&gt; Rohtak
                      [zip_code] =&gt; 15478
                      [status] =&gt; active
                  )
  
              [UserProfile] =&gt; Array
                  (
                      [first_name] =&gt; Arman
                      [last_name] =&gt; Kumar
                  )
  
          )
  
      [2] =&gt; Array
          (
              [DriverLocation] =&gt; Array
                  (
                      [id] =&gt; 3
                      [dispensary_id] =&gt; 1
                      [driver_id] =&gt; 77
                      [zip_code_id] =&gt; 41
                      [created] =&gt; 2015-05-25 12:45:47
                  )
  
              [ZipCode] =&gt; Array
                  (
                      [id] =&gt; 41
                      [province_id] =&gt; 3846
                      [city] =&gt; Malviya Vihar
                      [zip_code] =&gt; 12558
                      [status] =&gt; active
                  )
  
              [UserProfile] =&gt; Array
                  (
                      [first_name] =&gt; Manish
                      [last_name] =&gt; Kumar
                  )
  
          )
  
  )
  </code></pre>
  
  <p>I want to convert or change its format something like as follows.
  This will altered on the behalf of <code>DriverLocation=&gt;driver_id</code></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [DriverLocation] =&gt; Array
                  (
                      [id] =&gt; 1
                      [dispensary_id] =&gt; 1
                      [driver_id] =&gt; 85
                      [zip_code_id] =&gt; 42
                      [created] =&gt; 2015-05-25 12:01:14
                  )
  
              [ZipCode] =&gt; Array
                  (
                     [0] =&gt;  Array
                      (
                          [id] =&gt; 42
                          [province_id] =&gt; 3846
                          [city] =&gt; Rohtak
                          [zip_code] =&gt; 30215
                          [status] =&gt; active
                      )
                     [1] =&gt;  Array
                      (
                          [id] =&gt; 43
                          [province_id] =&gt; 3846
                          [city] =&gt; Rohtak
                          [zip_code] =&gt; 15478
                          [status] =&gt; active
                      )
  
                  )
  
              [UserProfile] =&gt; Array
                  (
                      [first_name] =&gt; Arman
                      [last_name] =&gt; Kumar
                  )
  
          )
  
  
  
      [1] =&gt; Array
          (
              [DriverLocation] =&gt; Array
                  (
                      [id] =&gt; 3
                      [dispensary_id] =&gt; 1
                      [driver_id] =&gt; 77
                      [zip_code_id] =&gt; 41
                      [created] =&gt; 2015-05-25 12:45:47
                  )
  
              [ZipCode] =&gt; Array
                  (
                      [id] =&gt; 41
                      [province_id] =&gt; 3846
                      [city] =&gt; Malviya Vihar
                      [zip_code] =&gt; 12558
                      [status] =&gt; active
                  )
  
              [UserProfile] =&gt; Array
                  (
                      [first_name] =&gt; Manish
                      [last_name] =&gt; Kumar
                  )
  
          )
  
  )
  </code></pre>