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.119 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.118 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.117 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.116 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.115 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.114 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.113 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.111 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.110 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.109 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.108 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.107 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.106 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.105 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.104 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.103 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.102 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.101 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.100 tracks/php/exercises/flatten-array/example.php
trackler-2.2.1.99 tracks/php/exercises/flatten-array/example.php