I've two array.
- is rules
$rules = [
"is_www" => true,
"no_encoding_meta_tag" => true,
"https_to_http_links" => false,
"has_render_blocking_resources" => false,
"low_content_rate" => false,
"title_too_short" => false,
"no_description" => false,
"no_favicon" => false
];
- is the array I want to check
$checks = [
"is_www" => false,
"no_encoding_meta_tag" => false,
"https_to_http_links" => true,
"has_render_blocking_resources" => true,
"low_content_rate" => false,
"title_too_short" => false,
"no_description" => false,
"no_favicon" => false
];
for this time my code is working fine
$issue = [];
foreach ($checks as $v => $i) {
foreach ($rules as $w => $j) {
if ($v == $w) {
if ($i != $j) {
$issue[$v] = $i;
}
}
}
}
var_dump($issue);
and the result is as expected
what I want to ask is about optimize for large data, how to get the best and fastest way to handle comparasion of two array, if I have much data for $rules
and for $check