Verifying key/value pairs between arrays

前端 未结 1 790
面向向阳花
面向向阳花 2021-01-27 15:12

I have a \"master\" array, and several arrays I have to verify against the master.

The master array is a list of key/value pairs. The other arrays have to be made of som

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-27 16:00

    Have a look at array_diff_assoc.

    $bad = (bool)count(array_diff_assoc($test_array, $master_array))
    

    In other words, $test_array does not validate if there are any differences, including the index check.

    0 讨论(0)
提交回复
热议问题