I have two arrays: Array ( [0] => 2 [1] => 3 ) and Array ( [0] => 2 ).
Array ( [0] => 2 [1] => 3 )
Array ( [0] => 2 )
I want to get the value, which is not in second array. So I
you can use array_values(array_diff($arr1, $arr2)); if order doesn't matter
array_values(array_diff($arr1, $arr2));
You should run array_values() on the result and this would give you a new array with indexes starting at 0.
array_values()
This is a known shortcoming of array_diff(), check the php docs.
array_diff()