I have two arrays:
Array (  => 2  => 3 ) and
Array (  => 2 ). I want to get the value, which is not in second array. So I have used the
array_diff function but my result will get
Array (  => 3 )
Actually this is the result. But a small problem here, its position is (key)
1. I want the result in to a new array starts from 0th position, i.e.,
Array (  => 3 ).
Does any one help me?
you can use
array_values(array_diff($arr1, $arr2)); if order doesn’t matter
You should run
array_values() on the result and this would give you a new array with indexes starting at 0.
This is a known shortcoming of
array_diff(), check the php docs.