Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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);
Comment

PREVIOUS NEXT
Code Example
Php :: wp do sql query from function 
Php :: strtoupper php 
Php :: yii2 get cookie 
Php :: php pass a variabele to js 
Php :: persian error laravel 
Php :: php get current url host 
Php :: how to check the size of mysql database in phpmyadmin 
Php :: php pdo set charset 
Php :: current page link using php 
Php :: wpml display language switcher 
Php :: allow extension image chrome, firefox 
Php :: laravel store multiple files 
Php :: laravel sidebar menu active 
Php :: query sql in php 
Php :: centos excecutable php 
Php :: laravel before migration 
Php :: get type of variable php 
Php :: laravel get only relationship 
Php :: php goto 
Php :: convert matrix row to column php 
Php :: wordpress get permalink in loop 
Php :: first item in array php 
Php :: remove repeated columns laravel 
Php :: Laravel - create model, controller and migration in single artisan command 
Php :: php artisan migrate not working 
Php :: read csv php 
Php :: php check if variable is string 
Php :: carbon date minus days 
Php :: how to request user input in php 
Php :: How to insert time in table using CodeIgniter 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =