tags:

views:

50

answers:

3
$arr1=array(23,43,54);
$arr2=array(34,23,3456,43,11,54);

I want to get elements of $arr2 that's not in $arr1

+8  A: 

array_diff() is your man. http://php.net/manual/en/function.array-diff.php

Stephen Melrose
+2  A: 

Take a look at: http://www.php.net/manual/en/function.array-diff.php

Mr-sk
+2  A: 

Try this:

$new_arr = array_diff($arr2, $arr1);

Hmmm, if that doesn't work, switch $arr1 and $arr2 around.

Manual -> http://php.net/manual/en/function.array-diff.php

ILMV