“Array_intersect php” Respostas de código

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 )
Lokesh003Coding

PHP obtém interseção de duas matrizes

$array1 = [1, 2];
$array2 = [2, 3, 4];
$commonValue = array_intersect($array1, $array2);
//$commonValue = 2
// If you have X number of arrays you can do:
$array1 = [1, 2];
$array2 = [2, 3, 4];
$arrayOfArrays = [$array1, $array2];
$commonValue = array_intersect(...$arrayOfArrays);
Unsightly Unicorn

PHP Array_intersect

PHP function array_intersect(array $array1, array $array2, array ...$_) int[]
-----------------------------------------------------------------------------
Computes the intersection of arrays
  
Parameters:
array--$array1--The array with main values to check.
array--$array2--An array to compare values against.
array--...$_--[optional]
Returns: an array containing all of the values in array1 whose values exist in all of the parameters.
Imtiaz Epu

Respostas semelhantes a “Array_intersect php”

Perguntas semelhantes a “Array_intersect php”

Mais respostas relacionadas para “Array_intersect php” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código