Sha256: ceb2921c9589620344f363ceead75e84f27e2f620bb3cedf5007596bb07b9127

Contents?: true

Size: 207 Bytes

Versions: 148

Compression:

Stored size: 207 Bytes

Contents

<?php

function flatten($array = [])
{
    $return = array();
    array_walk_recursive($array, function ($x) use (&$return) {
        return !is_null($x) ? $return[] = $x : [];
    });
    return $return;
}

Version data entries

148 entries across 148 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.179 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.178 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.177 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.176 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.175 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.174 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.173 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.172 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.171 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.170 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.169 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.167 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.166 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.165 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.164 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.163 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.162 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.161 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.160 tracks/php/exercises/flatten-array/example.php