且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP删除关联数组的数组,这些数组具有特定键的重复值

更新时间:2023-02-23 10:45:38

通过 contact_email 提取到数组并建立索引.由于不能有重复的索引,您将得到最后一次出现:

Extract to an array and index by contact_email. Since there cannot be duplicate indexes you'll get the last occurrence:

$array = array_column($array, null, 'contact_email');

如果您希望将其重新索引回整数:

If you want to re-index that back to integers:

$array = array_values(array_column($array, null, 'contact_email'));