Re: Copying array segments

From: Date: Fri, 04 Oct 2002 23:43:54 +0000
Subject: Re: Copying array segments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118918@lists.php.net to get a copy of this message
Rasmus Lerdorf wrote: > > > I've got an array that is 5 arrays deep, and I want to copy the array > > three levels down of one index into a new array. > > > > Example: > > $output['recommendernames'][0]['recommendername'][0]['com']; > > > > This is what I want to do: > > > > $newoutput = $output['recommendernames'][0]['recommendername']; > > > > So that newoutput is an array that is two arrays deep: > > $newoutput[0]['com'] > > > > Is there a special function for this? > > None needed. You just did it. *giggle* That's +1 for having a zen for the obvious ;) Cheers, Rob. -- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummings@webmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'

« previous php.general (#118918) next »