I have 2 arrays
$a = array("1", "2", "3", "4", "5");
$b = array("3", "4", "5", "6", "7");
I want the final result be ("6", "7")
It seems that array_diff()
and array_intersect()
can't give the result that I need.
I have 2 arrays
$a = array("1", "2", "3", "4", "5");
$b = array("3", "4", "5", "6", "7");
I want the final result be ("6", "7")
It seems that array_diff()
and array_intersect()
can't give the result that I need.
Yes, use array_diff
, what's your problem?
$arrayA = array("1", "2", "3", "4", "5");
$arrayB = array("3", "4", "5", "6", "7");
$result = array_diff($arrayB, $arrayA);
Docs:
Return Values
Returns an array containing all the entries from array1 that are not present in any of the other arrays.