title: Laravel - Remove elements having NULL value from multidimentional array
body: <p>I am using <code>Laravel 5.3</code>. </p>
  
  <p>I have a <code>multidimensional array</code> like: </p>
  
  <pre><code>Array
  (
      [id] =&gt; 37141
      [last_done_on] =&gt; []
      [children] =&gt; Array
          (
              [0] =&gt; NULL /* This must be removed */
              [1] =&gt; Array
                  (
                      [id] =&gt; 37142
                      [last_done_on] =&gt; Array()
                      [children] =&gt; Array()
                  )
  
              [2] =&gt; Array
                  (
                      [id] =&gt; 37143
                      [last_done_on] =&gt; Array()
                      [children] =&gt; Array
                          (
                              [0] =&gt; Array
                                  (
                                      [id] =&gt; 37144
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array()
                                  )
                              [1] =&gt; Array
                                  (
                                      [id] =&gt; 37145
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array()
                                  )
                          )
                  )
              [3] =&gt; Array
                  (
                      [id] =&gt; 37157
                      [last_done_on] =&gt; Array()
                      [children] =&gt; Array
                          (
                              [0] =&gt; Array
                                  (
                                      [id] =&gt; 37158
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array()
                                  )
                              [1] =&gt; Array
                                  (
                                      [id] =&gt; 37159
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array
                                          (
                                              [0] =&gt; NULL  /* This must be removed */
                                          )
                                  )
                          )
                  )
          )
  )
  </code></pre>
  
  <p>And I want to <code>remove</code> the <code>elements</code> that are <code>NULL</code>. So the result should be like: </p>
  
  <pre><code>Array
  (
      [id] =&gt; 37141
      [last_done_on] =&gt; []
      [children] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [id] =&gt; 37142
                      [last_done_on] =&gt; Array()
                      [children] =&gt; Array()
                  )
  
              [1] =&gt; Array
                  (
                      [id] =&gt; 37143
                      [last_done_on] =&gt; Array()
                      [children] =&gt; Array
                          (
                              [0] =&gt; Array
                                  (
                                      [id] =&gt; 37144
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array()
                                  )
                              [1] =&gt; Array
                                  (
                                      [id] =&gt; 37145
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array()
                                  )
                          )
                  )
              [2] =&gt; Array
                  (
                      [id] =&gt; 37157
                      [last_done_on] =&gt; Array()
                      [children] =&gt; Array
                          (
                              [0] =&gt; Array
                                  (
                                      [id] =&gt; 37158
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array()
                                  )
                              [1] =&gt; Array
                                  (
                                      [id] =&gt; 37159
                                      [last_done_on] =&gt; Array()
                                      [children] =&gt; Array
                                          (
                                          )
                                  )
                          )
                  )
          )
  )
  </code></pre>
  
  <p>How to do this?</p>