public static function flatten($array)
    {
        if (!is_array($array)) {
            // nothing to do if it's not an array
            return array($array);
        }

        $result = array();
        foreach ($array as $value) {
            // explode the sub-array, and add the parts
            $result = array_merge($result, static::flatten($value));
        }

        return $result;
    }
public static function flatten($array)
    {
        if (!is_array($array)) {
            // nothing to do if it's not an array
            return array($array);
        }

        $result = array();
        foreach ($array as $value) {
            // explode the sub-array, and add the parts
            $result = array_merge($result, static::flatten($value));
        }

        return $result;
    }
public static function flatten ( $ array ) { if ( ! is_array ( $ array ) ) { // nothing to do if it's not an array return array ( $ array ) ; } $ result = array ( ) ; foreach ( $ array as $ value ) { // explode the sub-array, and add the parts $ result = array_merge ( $ result , static :: flatten ( $ value ) ) ; } return $ result ; }
Flatten a multidimensional array.

@see https://stackoverflow.com/a/1320112
@param array|mixed $array
@return array
Flatten a multidimensional array .