[PHP] Copying array segments
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? __ Lon Lentz Applications Developer EXImpact.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copying array segments
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. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copying array segments
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:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php