Php array_intersect() Function

Php array_intersect() function is used to compare two or more arrays and which returns keys and values from array list. which functions have three arguments that are array arr1,array arr2,array arr3.in the first array is use to compare with other arrays. In the second array is a compare with the first array. In the third array is compare with first array and which array is optional.

Demo :



First Array Input :
Second Array Input :
 
 

Example :

You fill first array input list like this a,b,c and second array input list like this b,c,d then now will be to store both arrays list then click compare button finally out put will display like this Array Array ( [1] => b [2] => c ) .

Following code is array_intersect() function code if you need to copy and use to your website.


<?php
  $salt = array("sodium", "chlorine");
  $acid = array("hydrogen", "chlorine", "nitrogen");
  $intersection = array_intersect($acid, $salt);
  print_r($intersection);
?>

In the above have two arrays that first one is salt and second one is acid.which both have to stored $salt and $acid variables.In which both array have been pass to array_intersect() functions.finally the output will display on this broswer like this Array ( [1] => chlorine ).

Free Download Script :

If you need to array_intersect() function code click and download from following link.

Download




Content