What's the fastest ways to compare values in two different arrays
sawatkins
5:10 pm on May 1, 2008 (gmt 0)
So, I have two different arrays. I need to know which keys in Array1 match up with Array2, because I can only perform a certain function on the value of these arrays once.
Obviously, I can use a foreach statement, but these arrays can get quite large, and that seems like a very costly way to search through an array. There has to be a better way.
coopster
6:22 pm on May 1, 2008 (gmt 0)
I'm not certain what is fastest, never tested it myself. But the array_intersect_key [php.net] function for PHP >= 5.1.0 is an option.