Re: Proposal: array_flatten function

From: Date: Fri, 26 Dec 2008 13:55:23 +0000
Subject: Re: Proposal: array_flatten function
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-42381@lists.php.net to get a copy of this message
This one time, at band camp, "Mike Panchenko" <m@mihasya.com> wrote: > Hey everybody, I'm new both to the list and to hacking the internals, so > I'll try to keep it short and humble. > > I've written an array_flatten function which just takes all elements from a > nested array and pushes them into a single indexed array. function flattenArray(array $array){ $ret_array = array(); foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $value) { $ret_array[] = $value; } return $ret_array; } Kevin

« previous php.internals (#42381) next »