This would work ...

<?

  $arrA = array(1,2,3,4,5,6);
  $arrB = array(9,8,7,6,5);

  // pick an arbitrary one to start with ...
  for($i = 0 ; $i <= sizeof($arrB) ; ++$i)
    if(!in_array($arrB[$i],$arrA))
          $arrA[] = $arrB[$i];

?>


--Joe


On Fri, Apr 06, 2001 at 09:19:52AM +0100, Alexis Antonakis wrote:
> Hi,
> 
> I am having big problems with merging two arrays. I just can't seem to get
> my head around it.
> 
> I have two arrays which I wish to merge, but I want to EXCLUDE duplicate
> values.
> 
> Any suggestions, as my numerous attempts have proved unsuccessful.
> 
> BTW I'm using PHP4.
> 
> Many thanks
> Alexis
> 
> 
> -- 
> 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]


/******************************************************************************\
 *                    Joe Stump - PHP/SQL/HTML Developer                      *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\******************************************************************************/

-- 
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