|
Demonstrating array_intersect() - finding common values across many arrays |
|
array_intersect() takes two or more arrays as arguments. The function
returns an array of "intersections", or identical values that are
present in each of the other arrays. Note that keys are preserved.
-
<?php
-
$array1 = array("OH", "CA", "NY", "HI", "CT");
-
$array2 = array("OH", "CA", "HI", "NY", "IA");
-
$array3 = array("TX", "MD", "NE", "OH", "HI");
-
-
-
-
// from "Beginning PHP 5 and MySQL: From Novice to Professional", courtesty apress.com
-
?>
|