Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44517 invoked from network); 26 Dec 2008 13:55:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Dec 2008 13:55:25 -0000 Authentication-Results: pb1.pair.com header.from=kevin@phpro.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kevin@phpro.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain phpro.org from 80.76.201.53 cause and error) X-PHP-List-Original-Sender: kevin@phpro.org X-Host-Fingerprint: 80.76.201.53 swamp.phpro.org Received: from [80.76.201.53] ([80.76.201.53:45164] helo=swamp.phpro.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/27-33750-B42E4594 for ; Fri, 26 Dec 2008 08:55:24 -0500 Received: from kevin.kev ([58.172.208.9]) by swamp.phpro.org (8.13.8/8.13.8) with SMTP id mBQEHGqE023163 for ; Sat, 27 Dec 2008 01:17:17 +1100 Date: Sat, 27 Dec 2008 00:55:23 +1100 To: internals@lists.php.net Message-ID: <20081227005523.2961ecd4.kevin@phpro.org> In-Reply-To: <5faa7b820812260106p6f24bf0ct49ef574e5ed4e2c2@mail.gmail.com> References: <5faa7b820812260106p6f24bf0ct49ef574e5ed4e2c2@mail.gmail.com> Organization: PHPRO X-Mailer: Sylpheed version 2.0.4 (GTK+ 2.10.4; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal: array_flatten function From: kevin@phpro.org (Kevin Waterson) This one time, at band camp, "Mike Panchenko" 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