Forum Moderators: coopster

Message Too Old, No Replies

Excluding Certain Results

         

RandallK

4:14 pm on Feb 20, 2010 (gmt 0)

10+ Year Member



I have an array with numbers 1 and 3.

I have a second array with numbers 1-5.

I want to find all numbers in the second array that are NOT a part of the first (2, 4 and 5). What is the best way to accomplish this?

astupidname

11:59 pm on Feb 20, 2010 (gmt 0)

10+ Year Member



$a1 = array(1,3);
$a2 = array(1,2,3,4,5);
print_r(array_diff($a2,$a1));