Re: array_merge();

From: Date: Wed, 21 Nov 2001 14:59:21 +0000
Subject: Re: array_merge();
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75396@lists.php.net to get a copy of this message
Hi Edgardo, @ 8:09:26 AM on 11/21/01, Edgardo Rossetto wrote: > I have a problem width array_merge(); in PHP 4 beta 2 (my ISP sucks, sorry) > and i need to know if there's a similar function o way to do this. There's probably a faster/elegant way to do this, but this should work: <?php function arraymerge($one,$two) { while(list(,$x) = each($one)) { $merged[] = $x; } while(list(,$y) = each($two)) { $merged[] = $y; } return $merged; } /* example: */ $one = array('foo','baz','bar'); $two = array('baz','foo'); $merged = arraymerge($one,$two); while(list(,$val) = each($merged)) { print "$val "; } ?> -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies.

« previous php.general (#75396) next »