I have an array $myArray1
with some string values like 2 5 7 13 23 25
. Another array $myArray2
has string values like 2 4 7 11 13 25
.
My requirement is to get a third array $myArray3
having only those values of $myArray1
that are not present in $myArray2
i.e. 5 23
.
I have tried $myArray3 = array_diff($myArray1, $myArray2)
but then $myArray3[0]
displays Undefined offset: 0.
Please tell me, is there any function of PHP for this?