Native PHP functions are faster than trying to build your own algorithm.
$result = array_intersect($array1, $array2);
More Related Contents:
- PHP multidimensional array search by value
- How to sum all column values in multi-dimensional array?
- How to search by key=>value in a multidimensional array in PHP
- How to check if PHP array is associative or sequential?
- What is the best way to loop through this array in PHP?
- mysqli bind_param() expected to be a reference, value given
- Build a tree from a flat array in PHP
- What’s the best way to get the last element of an array without deleting it?
- Convert a comma-delimited string into array of integers?
- Convert array into csv
- Search for a key in an array, recursively
- Get the first N elements of an array?
- Get difference between associative rows of two 2-dimensional arrays
- php var_dump() vs print_r()
- PHP combine two associative arrays into one array
- using array_search for multi dimensional array
- Is there a way to fetch associative array grouped by the values of a specified column with PDO?
- Comment associative array in PHP Documentor
- Get the maximum value from an element in a multidimensional array? [duplicate]
- Returning first x items from array
- What is the difference between array_udiff_assoc() and array_diff_uassoc()?
- Move an array element to a new index in PHP
- How do I declare a two dimensional array?
- PHP get all arguments as array?
- Convert PHP array string into an array
- Combine two 2d arrays and have duplicate rows removed
- Change array key without changing order
- Moving array element to top in PHP
- phpexcel Allowed memory size of 134217728 bytes exhausted [duplicate]
- PHP, pass array through POST