title: How to count multidimensional array values?
body: <p>I am building an MLM software in PHP, one of its function is to count the downline performance.
  It creates an array from parent-child relationships, which can be seen below.
  How can I get the performance (array key: points) of my children, and their grandchildren as well through the fifth down level?</p>
  
  <pre><code>    Array
  (
      [children] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [id] =&gt; 1
                      [name] =&gt; Medvedev
                      [email] =&gt; 
                      [points] =&gt; 7
                      [children] =&gt; Array
                          (
                              [0] =&gt; Array
                                  (
                                      [id] =&gt; 3
                                      [name] =&gt; Putin
                                      [email] =&gt; 
                                      [points] =&gt; 4
                                      [children] =&gt; Array
                                          (
                                              [0] =&gt; Array
                                                  (
                                                      [id] =&gt; 5
                                                      [name] =&gt; Nathan
                                                      [email] =&gt; 
                                                      [points] =&gt; 3
                                                  )
  
                                              [1] =&gt; Array
                                                  (
                                                      [id] =&gt; 7
                                                      [name] =&gt; George
                                                      [email] =&gt; 
                                                      [points] =&gt; 666
                                                  )
  
                                          )
  
                                  )
  
                              [1] =&gt; Array
                                  (
                                      [id] =&gt; 4
                                      [name] =&gt; Lucas
                                      [email] =&gt; 
                                      [points] =&gt; 43
                                  )
  
                          )
  
                  )
          )
  
      [id] =&gt; 27
      [name] =&gt; Boss
      [email] =&gt; 
      [points] =&gt; 99999
  )
  </code></pre>