User-Profile-Image
hankin
  • 5
  • 日记
  • 新闻
  • 微博
  • 仓库
  • 音乐
  • 程序人生
    • python
    • php
    • mysql
    • linux
    • go
  • 关于我
    • 博主简介
  • 友情链接
    • 知向前端
Help?

Please contact us on our email for need any support

Support
    首页   ›   php   ›   正文
php

判断两个数组是否存在交集

2020-05-15 16:30:36
88  0 0

随便两个数组当做参数 ,然后传入这个方法.就可以得到方法

function get_array_intersection($array_A,$array_B){ 
    if(!isset($array_A) || !isset($array_B) || !is_array($array_A) || !is_array($array_B) || ($array_A) || ($array_B)){ 
      return false; 
    } 
    foreach($array_A as $temp){ 
      if(in_array($temp,$array_B)){ 
        return true; 
      } 
    } 
    unset($array_A,$array_B,$temp); 
    return false; 
} 

如本文“对您有用”,欢迎随意打赏作者,让我们坚持创作!

0 打赏
评论 (0)

点击这里取消回复。

欢迎您 游客  

doralf
28文章 3评论 0点赞 3531浏览
搜一搜,你想干啥
近期文章
  • Mac 配置 Docker 镜像加速
  • 在多个数组里面找出某个字段的不同值
  • cgi、fastcgi、php-cgi、php-fpm剖析
  • php.ini常用配置
  • 计算机下载
标签
centos cron docker github go javascript linux MySQL nginx php thinkphp
我的微信
交换友情链接

通过上面的二维码加我微信
然后把你的链接发过来
我这边会手动给你添加
交个朋友,多个链接
人生挺美好的 哈哈

微信公众号
  • 0
  • 0
  • 5
  • 3
  • 1,232
  • 793
  • 0
  • 0
Copyright © 2021
主页
页面
  • 博主简介
博主
doralf 管理员
28 文章 3 评论 3531 浏览
测试
测试
赞赏作者

请通过微信、支付宝 APP 扫一扫

感谢您对作者的支持!

 支付宝 微信支付