我将两个数组传递给一个函数,然后我想遍历第一个数组并对照第二个数组检查一些值。问题是第二个数组给出了奇怪的值并破坏了逻辑。请有人指出我在哪里愚蠢吗?
功能
function completion($check, $values){
$num = count($values);
$i=0;
foreach($values as $a){
foreach($check as $b){
if($b[$a] == ''){
return '<span class="w"><i>incomplete</i></span>';
break;
}
}
$i++;
}
if ($i == $num);
return;
}
$values = array('short_bio', 'industry_sector', 'profile_status', 'country', 'locations', 'noe');
$check = ( [row] => 1 [user_id] => 2 [company_name] => mylittlefish [industry_sector] => Automotive / Aerospace [job_title] => Director [profile_status] => [first_name] => Joe [last_name] => Hodgson [package] => [sector] => Catering [recruitment_status] => Keeping an ear to the ground [country] => UK [locations] => Doncaster [noe] => 5 [user_recruitment_status] => [user_endorsements] => [short_bio] => test [previous_job_title] => [summary] => [profile] => [cover] => )
如果我回应$b[$a]
我会得到这样的东西:
612mADJHCKUD5t12mADJHCKUD5t12mADJHCKUD5t12mADJHCKUD5t12mADJHCKUD5t12mADJHCKUD5t6
希望你能帮忙
乔