php-Arrays函数-array_intersect_ukey-用回调函数比较键名来计算数组的交集
array_intersect_ukey() 用回调函数比较键名来计算数组的交集
【功能】
该函数将返回一个数组,
该数组包含了所有在array1中但是不在其他任何参数数组中的键名的值。
此比较是通过用户提供的回调函数进行的。
如果认为第一个参数小于、等于、或大于第二个参数时,必须返回
一个小于零、等于零,或大于零的整数
【使用范围】
php5>5.1.0.
【使用】
array array_intersect_ukey( array array1, array array2[,array...,callback key_compare_func] )
array1/必需/数组1
array2/必需/比较的数组 最少得有一个
array.../可选/用来比较的数组
key_compare_func.../可选/为用户提供作为比较标准的回调函数
【示例】
[php]
function key_compare_func($key1,$key2)
{
if($key1==$key2)
return 0;
else if($key1>$key2)
return 1;
else
return -1;
}
//分别定义两个数组
$array1 = array("blue"=>1,"red"=>2,"green"=>3,"purple"=>4);
$array2 = array("green"=>5,"blue"=>6,"yellow"=>7,"cyan"=>8);
var_dump(array_intersect_ukey( $array1,$array2,'key_compare_func'));
/*
array(2) {
["blue"]=>
int(1)
["green"]=>
int(3)
}
*/
摘自 zuodefeng的笔记

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.