function path_redirect_compare_array in Path redirect 6
Compare tha all values and associations in one array match another array.
We cannot use array_diff_assoc() here because we need to be recursive.
Parameters
$match: The array that has the values.
$haystack: The array that will be searched for values.
2 calls to path_redirect_compare_array()
- PathRedirectUnitTest::testCompareArray in ./
path_redirect.test - path_redirect_load_by_source in ./
path_redirect.module - Load a redirect by incoming path and language.
File
- ./
path_redirect.module, line 613
Code
function path_redirect_compare_array($match, $haystack) {
foreach ($match as $key => $value) {
if (!array_key_exists($key, $haystack)) {
return FALSE;
}
elseif (is_array($value)) {
if (!is_array($haystack[$key])) {
return FALSE;
}
elseif (!path_redirect_compare_array($value, $haystack[$key])) {
return FALSE;
}
}
elseif ($value != $haystack[$key]) {
return FALSE;
}
}
return TRUE;
}