Answers for "array_intersect()."

PHP
6

array_intersect php

<?php
$a1 = array("a"=>"red", "b"=>"green", "c"=>"blue", "d"=>"yellow");
$a2 = array("e"=>"red", "f"=>"green", "g"=>"blue");

$result = array_intersect($a1, $a2);
print_r($result); //Array ( [a] => red [b] => green [c] => blue )
Posted by: Guest on January-09-2021
1

array intersect

array_intersect(array $array, array ...$arrays): array

/* Returns an array containing all of the values in array whose 
   values exist in all of the parameters. */
Posted by: Guest on September-23-2021

Browse Popular Code Answers by Language