Compare to values of two arrays in PHP

前端 未结 6 1414
南方客
南方客 2021-01-20 14:56

Hi i want to compare all the values of 2 arrays and end up with a true or false . I am using the code below and would of thought that the result would be false . but that is

6条回答
  •  没有蜡笔的小新
    2021-01-20 15:15

    It might sound silly, but comparing two array of different lengths will NOT yield expected difference. Check the length of the arrays first and if they match then use array_diff. Otherwise your diff will always be empty.

提交回复
热议问题