Guest User

Untitled

a guest
Jul 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. a[0]={1,2,3};
  2. a[1]={2,3,4};
  3. **Edit** in a[2] from a[2]={4,5};
  4. a[2]={2,4,5};
  5. and more
  6.  
  7. call_user_func_array('array_intersect',$a);
  8.  
  9. $intersect = $a[0];
  10. for ($i = 1; $i < count($a); $i++)
  11. {
  12. $intersect = array_intersect($intersect, $a[$i]);
  13. }
  14.  
  15. <?php
  16. $array1 = array("a" => "green", "red", "blue");
  17. $array2 = array("b" => "green", "yellow", "red");
  18. $result = array_intersect($array1, $array2);
  19. print_r($result);
  20. ?>
  21.  
  22. Array
  23. (
  24. [a] => green
  25. [0] => red
  26. )
Add Comment
Please, Sign In to add comment