Verifying key/value pairs between arrays

前端 未结 1 788
面向向阳花
面向向阳花 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条回答
  • 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)
提交回复
热议问题