我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何找到2个索引数组与关联数组作为子节点的交集和并集?

The scenario is this. I have an array of items, in this format:

$a = [
    ['name' => 'John'],
    ['name' => 'Doe']
];

In a further update, I get a new array with some values removed while some added. It looks like this:

$b = [
    ['name' => 'John'],
    ['name' => 'Smith']
];

How would I calculate the union and the difference of these 2, so that I can remove Doe from my database and add Smith since my new data has these changes?

近期文章

  • Woocommerce Order / AFC get_sub_field / get_sub_field_object(array)
  • PHP Composer问题
  • PHP数组到YAML
  • 通过php从html页面裁剪文本
  • Bootstrap Modal Form不适用于CodeIgniter
  • 语法错误:输入ajax的意外结束
  • 在Facebook Wall发布,作为页面 - 给出错误
  • Php Listener / Client Lopped正在收听服务器?
  • 将PHP代码放在HTML文件中的位置(对于联系表单)?
  • 在第二个参数中使用DB :: raw()时的不同值where()
  • 如何在LAMP堆栈中全局禁用EXIF支持?
  • 根据某些标准交换数组中的元素
  • Codeigniter - 站点地图错误
  • 左连接子查询返回Null
  • Laravel 5.1:试图通过关系获取foreach循环中非对象的属性
  • 如何将PDO与codeigniter 3一起使用
  • 多次发送短信
  • PHP扩展了类
  • 在提交按钮上加载第二个DIV,单击第一个DIV,使第一个DIV在同一页面上可见
  • android使用Asynchronous Http Client如何将多文件上传到服务器var php?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华