php求两个数组的差集方法

 时间:2024-10-14 02:05:37

1、先定义两个数组:<?php $a=array('orange','pear','apple','banana'); $b=array('bread','milk','orange','banana','apple','phone','rice');

2、用函数array_diff():$intersection = array_diff($a,$b);

3、用print_r()打印数组:print_r($intersection);

4、组成新的数组结果如下图:

php求两个数组的差集方法

5、分析:‘orange','banana','apple'均有,所以新数组返回pear.

  • 河南省考地点是怎么安排的
  • 超市冷冻鳕鱼排怎么煎
  • 2022年光遇红包封面口令是什么
  • 吃青笋有助于长头发
  • 中国十大最具特色的火车站
  • 热门搜索
    重庆工商大学怎么样 word怎么删除页面 小孩口腔溃疡怎么办 怎么做人 眼睛浮肿怎么办 论文怎么查重 肚脐上方疼痛怎么回事 学习目标怎么写 奥迪a4l怎么样 aunt怎么读