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.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to