php arrays - in_array and/or array_intersect

jonespizzazz

New Member
It's another day for being thick—so sorry. :) Anyhow, I have 2 arrays that I want to manipulate; if a value from the first array exists in the second array do one thing and then do something else with the remaining values of the second array.e.g.\[code\]$array1 = array('1','2','3','4'); - the needle$array2 = array('1','3','5','7'); - the haystackif(in_array($array1,$array2): echo 'the needle'; else: echo'the haystack LESS the needle '; endif;\[/code\]But for some reason the \[code\]in_array\[/code\] doesn't work for me. Help please.
 
Back
Top