Re: Dynamic array_merge problem

From: Date: Wed, 12 Apr 2006 13:27:03 +0000
Subject: Re: Dynamic array_merge problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-233832@lists.php.net to get a copy of this message
Hi if you just want to sort of concatenate your arrays then why not just loop through the whole thing in order to get the new single array. Need more info for further consideration. Hope this helps! for ($i=0;$i<count($z);$i++){ $z1[$i] = $z[$i]; } Pure Web Solution http://www.purewebsolution.co.uk PHP, MYSQL, Web Design & Web Services "Ace McKool" <face7hill@gmail.com> wrote: > Hi, > > This is the end result I'm trying to get: > > $z1 = array_merge($z[0], $z[1], $z[2]); > > But what if I don't know how many elements are in $z? I tried this (but it > breaks if there are more than 2 elements in $z): > > for ($i=0; $i<count($z); $i++) > { > if ($i<(count($z)-1)) > { > $z1 = array_merge($z[$i], $z[$i+1]); > } > } > > Any pointers would be greatly appreciated! TIA

« previous php.general (#233832) next »