php4的array类函数友多了三个新成员;
分别是:array_unique(), array_intersect() 和 array_diff ()。
顾名思义,这三个函数很简单:
1. array_unique(array array) ------- 将数组中重复的元素去除,然后返回该数组
eg:
$arr = array("a","b","c","b");
$arr = array_unique($arr);
var_dump($arr); ----显示$arr只包含三个元素"a","b","c"
2. array_intersect(array array1,array,array2 .....) ---- 以数组形式返回多个数组中共同拥有的元素
eg:
$arr1 = array("a","b","c","d");
$arr2 = array("e","f","b","a");
$arr = array_unique($arr);
var_dump($arr); ----显示$arr包含两个元素"a","b"
3. array_diff(array array1,array array2) ----- 以数组形式返回array1相较于array2没有的元素。
eg:
$arr1 = array("a","b","c","d");
$arr2 = array("e","f","b","a");
$arr = array_unique($arr);
var_dump($arr); ----显示$arr包含两个元素"c","d" 我感觉php4更人性化了

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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

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

Dreamweaver CS6
Visual web development tools