src/Synapse/Stdlib/Arr.php
public static function flatten($array)
    {
        $is_assoc = Arr::isAssoc($array);

        $flat = [];
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flat = array_merge($flat, Arr::flatten($value));
            } else {
                if ($is_assoc) {
                    $flat[$key] = $value;
                } else {
                    $flat[] = $value;
                }
            }
        }

        return $flat;
    }
public static function flatten($array)
    {
        $is_assoc = Arr::isAssoc($array);

        $flat = [];
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flat = array_merge($flat, Arr::flatten($value));
            } else {
                if ($is_assoc) {
                    $flat[$key] = $value;
                } else {
                    $flat[] = $value;
                }
            }
        }

        return $flat;
    }
public static function flatten ( $ array ) { $ is_assoc = Arr :: isAssoc ( $ array ) ; $ flat = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ flat = array_merge ( $ flat , Arr :: flatten ( $ value ) ) ; } else { if ( $ is_assoc ) { $ flat [ $ key ] = $ value ; } else { $ flat [ ] = $ value ; } } } return $ flat ; }
Convert a multi-dimensional array into a single-dimensional array.

$array = array('set' => array('one' => 'something'), 'two' => 'other');

// Flatten the array
$array = Arr::flatten($array);

// The array will now be
array('one' => 'something', 'two' => 'other');

[!!] The keys of array values will be discarded.

@param  array $array array to flatten
@return array
@since   3.0.6
Convert a multi - dimensional array into a single - dimensional array .