compare two PHP arrays by key

后端 未结 3 1473
南笙
南笙 2021-01-13 05:17

What\'s the fastest way to compare if the keys of two arrays are equal?

for eg.

array1:          array2:

\'abc\' => 46,     \'abc\' => 46,
\'d         


        
3条回答
  •  遥遥无期
    2021-01-13 05:58

    Use array_keys to get array of keys and then use array_diff.

    OR

    Use array_diff_key directly.

提交回复
热议问题