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.139 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.138 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.137 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.136 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.135 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.134 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.133 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.132 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.131 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.130 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.129 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.128 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.127 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.126 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.125 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.124 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.123 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.122 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.121 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.120 tracks/php/exercises/flatten-array/example.php