title: PHP Checkbox checked is not working correctly when comparing 2 Arrays
body: <p>I trying to compare 2 Arrays and then let the Checkbox to be checked if there are common values between them.</p>
  
  <p><strong>coding</strong></p>
  
  <pre><code>$array_1[]="value1";
  $array_1[]="value2";
  $array_1[]="value3";
  $array_1[]="value4";
  $array_1[]="value5";
  $array_1[]="value6";
  $array_1[]="value7";
  $array_1[]="value8";
  
  $array_2[]="value1";
  $array_2[]="value3";
  $array_2[]="value4";
  
  
  for($i=0;$i&lt;count($array_1);$i++){
      $checked = isset($array_2[$i])? 'checked' : '';
      echo '&lt;input type="checkbox" ' . $checked .' name="zzz[] "value="'.$array_1[$i].'"&gt; '.$array_1[$i].'&lt;br&gt;';
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/9F8tB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9F8tB.jpg" alt="enter image description here"></a></p>
  
  <p><strong>as you can see from the screenshot, the correct result should be right side with value1, value3 and value4. However, my php output is leftside of the screenshot</strong></p>
  
  <p>Anyone knows what's wrong ?</p>