[PHP] Help with matchng strings

2002-08-25 Thread rdkurth
I have two list one is listA and the other is listB I would like to take the values in listB and compare them with listA if any of them match then I what to create a new list listC and put the values that match in it. If they do not match I want the values to go into listD. I have been messing

Re: [PHP] Help with matchng strings

2002-08-25 Thread Rasmus Lerdorf
array_intersect() will give you listC directly. Just feed it list A and B. Then you can take a copy of listA and do a foreach on the array_keys() of listC and unset() them. Now this copy with the removed elements becomes your listD -Rasmus On Sun, 25 Aug 2002 [EMAIL PROTECTED] wrote: I

Re[2]: [PHP] Help with matchng strings

2002-08-25 Thread rdkurth
Hello Rasmus, Ok I understand the array_intersect and have gotten that to work. I just don't understand the second part using the foreach and unset(). this is what I have it gives me three separate list $listA=tester1 tester2 tester3 tester4 tester5 tester6 tester7 tester8 tester9;

Re: [PHP] Help with matchng strings

2002-08-25 Thread Bas Jobsen
$lista=array(1,2,3,4,5,6,7,8,9); $listb=array(4,6,8); $listc=array_intersect($lista,$listb); $listd=array_diff($lista,$listb); Op maandag 26 augustus 2002 01:48, schreef Rasmus Lerdorf: array_intersect() will give you listC directly. Just feed it list A and B. Then you can take a copy of