How to reset indexes in array_diff result?

前端 未结 2 794
后悔当初
后悔当初 2021-01-07 16:27

I have two arrays: Array ( [0] => 2 [1] => 3 ) and Array ( [0] => 2 ).

I want to get the value, which is not in second array. So I

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-07 17:16

    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.

提交回复
热议问题