Re: Proposal: array_flatten function

From: Date: Fri, 26 Dec 2008 18:04:23 +0000
Subject: Re: Proposal: array_flatten function
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-42383@lists.php.net to get a copy of this message
Why not just link straight to the tutorial on your site? ;) Not sure what your point is, other than "there's a way to do this in userland," which I cover in my email. Maybe some sentences to accompany it would make it easier to understand. Thanks for reading. Cheers. Mike. On Fri, Dec 26, 2008 at 5:55 AM, Kevin Waterson <kevin@phpro.org> wrote: > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#42383) next »