Re: Array problem

From: Date: Fri, 06 Apr 2001 16:02:17 +0000
Subject: Re: Array problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-47455@lists.php.net to get a copy of this message
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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net /******************************************************************************\ * 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." * \******************************************************************************/

« previous php.general (#47455) next »