Re: array_merge();
| From: | Edgardo Rossetto | Date: | Thu, 22 Nov 2001 00:04:26 +0000 |
| Subject: | Re: array_merge(); | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75458@lists.php.net to get a copy of this message | ||
It works, thanks.
Edgardo
"Brian Clark" <brianj@fusionwerks.com> escribió en el mensaje
news:94312118121.20011121095921@fusionwerks.com...
> 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.
>