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.98 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.97 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.96 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.95 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.94 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.93 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.92 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.91 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.90 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.89 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.88 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.87 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.86 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.85 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.84 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.83 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.82 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.81 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.80 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.79 tracks/php/exercises/flatten-array/example.php