Home > Backend Development > PHP Tutorial > php array_intersect() function usage code_PHP tutorial

php array_intersect() function usage code_PHP tutorial

WBOY
Release: 2016-07-21 15:47:53
Original
1201 people have browsed it

array array_intersect (array array1, array array2 [, array ...])
array_intersect() function returns the intersection array of two or more arrays.
array_intersect() returns an array containing all values ​​in array1 that also appear in all other parameter arrays. Note that the key names remain unchanged.
Let me show you the example from the manual:


$array1 = array ("a" => "green", "red", " blue");
$array2 = array ("b" => "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
print_r ($result);
?>
The output result is as follows:

Array
(
[a] => green
[0] => red
)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319826.htmlTechArticlearray array_intersect (array array1, array array2 [, array ...]) array_intersect() function returns two or Intersection array of multiple arrays. array_intersect() returns an array...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template