note 109993 deleted from function.array-walk-recursive by aharvey
| From: | aharvey@php.net | Date: | Mon, 10 Sep 2012 01:19:40 +0000 |
| Subject: | note 109993 deleted from function.array-walk-recursive by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190598@lists.php.net to get a copy of this message | ||
Note Submitter: maxim at inbox dot ru
----
qfox at ya dot ru gives a broken function, here is a fixed version in one line of code,
i was need to collect only values:
<?php
function array_flatten(array $arr,$flat = array())
{return array_walk_recursive($arr,function ($val) use (&$flat) {$flat[] = $val;}) ? $flat :
false;}
?>