How do I compare array key without using foreach
<p>I got an multidimentional array <code>$finalUserElearningLesson</code>. What I wanna do is to compare its keys with keys of another array. <code>if($finalUserElearningLesson[$i][$field] == $field)</code> is not actually compare the key but the value. How do I compare the keys?</p>

<pre><code>for($i=0;$i&lt;count($finalUserElearningLesson);$i++) {
$uFields = array();
foreach($fields as $field) {
  if($finalUserElearningLesson[$i][$field] == $field){
    $uFields[$field] = $finalUserElearningLesson[$i][$field];
  }
}

fputcsv($output, $uFields);  
}    
</code></pre>
