Horje
array_intersect php Code Example
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 )
php get intersection of two arrays
$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);
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.
Source: www.php.net




Php

Related
laravel disable config cache Code Example laravel disable config cache Code Example
rollback laravel transaction Code Example rollback laravel transaction Code Example
laravel db commit Code Example laravel db commit Code Example
laravel db transaction Code Example laravel db transaction Code Example
how if charactor is exist in text in laravel Code Example how if charactor is exist in text in laravel Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11