title: php nested array unset element with key
body: <p>I need to unset the [device_id] element from the every array.
  I tried with recursive. But i am not able to do this. Can any one help on this. I tried like this.</p>
  
  <pre><code>foreach($tree as $key) {
      foreach($key as $value =&gt; $k){
          if ($value == 'device_id'){
              unset($k['device_id']);
          }
      }   
  }
  </code></pre>
  
  <p>I have nested multidimensional array as below:</p>
  
  <pre><code>Array
  (
      [4] =&gt; Array
          (
              [device_id] =&gt; 4
              [device_parent_id] =&gt; 2
              [device_ext] =&gt; 20122
              [device_name] =&gt; section controller1
              [username] =&gt; sectioncontroller1
              [password] =&gt; 90714771f0abd448f208e1aff5b662fc
              [device_macaddress] =&gt; 
              [device_ip] =&gt; 
              [device_desc] =&gt; 
              [admin_id] =&gt; 2
              [children] =&gt; Array
                  (
                      [5] =&gt; Array
                          (
                              [device_id] =&gt; 5
                              [device_parent_id] =&gt; 4
                              [device_ext] =&gt; 20199
                              [device_name] =&gt; Emergency1
                              [username] =&gt; Emergency1
                              [password] =&gt; bb75df6eb4fdbf5753640a34674ecce1
                              [device_macaddress] =&gt; 
                              [device_ip] =&gt; 
                              [device_desc] =&gt; 
                              [admin_id] =&gt; 2
                              [children] =&gt; Array
                                  (
                                  )
                          )
                      [6] =&gt; Array
                          (
                              [device_id] =&gt; 6
                              [device_parent_id] =&gt; 4
                              [device_ext] =&gt; 20111
                              [device_name] =&gt; HQ Phone
                              [username] =&gt; HQPhone
                              [password] =&gt; 2f89d97f24539dc50ddd8fc53667b194
                              [device_macaddress] =&gt; 
                              [device_ip] =&gt; 
                              [device_desc] =&gt; 
                              [admin_id] =&gt; 2
                              [children] =&gt; Array
                                  (
                                  )
                          )
                      [9] =&gt; Array
                          (
                              [device_id] =&gt; 9
                              [device_parent_id] =&gt; 4
                              [device_ext] =&gt; 20144
                              [device_name] =&gt; Other controller1
                              [username] =&gt; Othercontroller1
                              [password] =&gt; 861426b485e2afd62ad0d914f524f23c
                              [device_macaddress] =&gt; 
                              [device_ip] =&gt; 
                              [device_desc] =&gt; 
                              [admin_id] =&gt; 2
                              [children] =&gt; Array
                                  (
                                      [10] =&gt; Array
                                          (
                                              [device_id] =&gt; 10
                                              [device_parent_id] =&gt; 9
                                              [device_ext] =&gt; 30122
                                              [device_name] =&gt; Way Station1
                                              [username] =&gt; WayStation1
                                              [password] =&gt; 085d397b0392d3a325216a716c757113
                                              [device_macaddress] =&gt; 
                                              [device_ip] =&gt; 
                                              [device_desc] =&gt; 
                                              [admin_id] =&gt; 2
                                              [children] =&gt; Array
                                                  (
                                                  )
                                          )
                                  )
                          )
                  )
          )
  
      [21] =&gt; Array
          (
              [device_id] =&gt; 21
              [device_parent_id] =&gt; 2
              [device_ext] =&gt; 1123299
              [device_name] =&gt; sectioncontroller99
              [username] =&gt; sectioncontroller3
              [password] =&gt; 73d25d443117f76c6fe6bd5a4679f458
              [device_macaddress] =&gt; 124511251419
              [device_ip] =&gt; 124.235.63.569
              [device_desc] =&gt; test section9
              [admin_id] =&gt; 0
              [children] =&gt; Array
                  (
                      [22] =&gt; Array
                          (
                              [device_id] =&gt; 22
                              [device_parent_id] =&gt; 21
                              [device_ext] =&gt; 9999
                              [device_name] =&gt; emergancy
                              [username] =&gt; emergancy
                              [password] =&gt; c2bc24d3d41ad9ade0171c3d5d6f59c6
                              [device_macaddress] =&gt; 1245122
                              [device_ip] =&gt; 124.235.235
                              [device_desc] =&gt; sdfdf sdfsdf sdfsd
                              [admin_id] =&gt; 0
                              [children] =&gt; Array
                                  (
                                  )
                          )
                  )
          )
  );
  </code></pre>