title: How to use in array ? Warning: in_array() expects parameter 2 to be array, string given in
body: <p>How can I deal with this error:</p>
  
  <blockquote>
    <p>Warning: <code>in_array()</code> expects parameter 2 to be array, string given in C:\xampp\htdocs\php\index.php </p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>if (!isset($_GET['jenis'])) {
    $jenis =  "";
  } else {
    $jenis = $_GET['jenis'];
  }
  
  
  &lt;li&gt;&lt;input type="checkbox" onclick="jeniss();" name="jenis[]" value="11" &lt;?php if (in_array("11",$jenis))  { echo "checked"; } ?&gt; &gt; &lt;a&gt; 11 &lt;/a&gt; &lt;/li&gt;
  &lt;li&gt;&lt;input type="checkbox" onclick="jeniss();" name="jenis[]" value="12" &lt;?php if (in_array("12",$jenis))  { echo "checked"; } ?&gt; &gt; &lt;a&gt; 12 &lt;/a&gt; &lt;/li&gt;
  &lt;li&gt;&lt;input type="checkbox" onclick="jeniss();" name="jenis[]" value="13" &lt;?php if (in_array("13",$jenis))  { echo "checked"; } ?&gt; &gt; &lt;a&gt; 13 &lt;/a&gt; &lt;/li&gt;
  </code></pre>
  
  <p><strong>Note:</strong> the error at HTML input type when the page has not posted anything yet.</p>