/**
  * Reduce a nested array to a single level array
  * 
  * <p>
  * Reduce a nested array (associative or simple) to a single level array. Simple arrays will be unwrapped and stacked at the same position. In associative array, the less deep key is kept. 
  * <pre><code>Toolbox::array_flatten(array(array(1,2),array(3,4))); // will output array(1,2,3,4)
  * Toolbox::array_flatten(array(1 => 1,2 => array(1 => "A",3 => 3)));	// will output array(1 => 1, 3 => 3)
  * </code></pre>
  * 
  * @param mixed[] $array    The multilevel array to flatten
  *                           
  * @return mixed[]    Return a single level array
  */
 public static final function array_flatten($array)
 {
     $return = array();
     foreach ($array as $key => $value) {
         if (is_array($value)) {
             $return = array_merge(Toolbox::array_flatten($value), $return);
         } else {
             $return[$key] = $value;
         }
     }
     return $return;
 }