我有一个函数可以比较通过我的函数推送的两个数组。问题是,我可以根据计数比较两个不同数组的值。我的代码如下:
function Array_Smoke($Array_1, $Array_2)
{
$Return_Array = array();
$Array_Count = count($Array_1);
foreach ($Array_1 AS $SmokedKeys => $SmokedValues)
{
if (in_array($SmokedValues, $Array_2))
{
$Return_Array[] = $SmokedValues;
}
}
if ($Array_Count == count($Return_Array))
{
return "Arrays Match Up";
}
else
{
return "Arrays Do Not Match Up";
}
}
$Array_1 = array(
"Primary Key Number 1" => "Primary Value Number 2",
"Sub Key Number 1" => "Sub Value Number 1",
"Sub key Number 3" => "Sub Value Number 3",
"Sub Key Number 2" => "Sub Value Number 2",
);
$Array_2 = array(
"Primary Key Number 1" => "Primary Value Number 2",
"Sub Key Number 1" => "Sub Value Number 1",
"Sub key Number 2" => "Sub Value Number 2",
"Sub Key Number 3" => "Sub Value Number 3",
);
echo Array_Smoke($Array_1, $Array_2);
我将如何修改我的函数以根据数组的键和值进行比较?