title: recursively add elements to array and return new array
body: <p>Let's say I have an array like this:</p>
  
  <pre><code>$my_array = array(1, 2, 3, 4, array(11, 12, 13, 14), 6, 7, 8, array(15, 16, 17, 18), 10);
  </code></pre>
  
  <p>I want to build a recursive function that returns an array which contains all the even numbers from <code>my_array</code>. I tried something like:</p>
  
  <pre><code>function get_even_numbers($my_array)
  {
      $even_numbers = array();
  
      foreach($my_array as $my_arr)
      {
          if(is_array($my_arr)
          {
              get_even_numbers($my_arr);
  
              foreach($my_arr as $value)
              {
                  if($value % 2 == 0)
                  {
                      $even_numbers[] = $value;
                  }
              }
          }
      }
  
      return even_numbers;
  }
  </code></pre>
  
  <p>But it doesn't works.</p>
  
  <p>Thank you</p>