PHP how to check the checkbox by using if else condition within echo?
<pre><code>echo '&lt;input type="checkbox" name="check_list[]" value="OMG" checked&gt;';
</code></pre>

<p>this way will display a normal checkbox with checked. My question is that is it possible to put a if else inside the checkbox? </p>

<p>For example,  </p>

<pre><code>echo '&lt;input type="checkbox" name="check_list[]" value="OMG" "if(2&gt;1){ echo "checked";};" &gt;'; 
</code></pre>

<p>The reason i want to do this is because I have a array with 6 data, if certain condition meet, the checkbox will be checked. If the echo method i mentioned above is invalid, so what's the correct way of doing that? </p>

<pre><code>$zzz[1]="western food";
$zzz[2]="chinese food";
$zzz[3]="mix food";
$zzz[4]="japanese food";
$zzz[5]="korean food";
$zzz[6]="italian food";
</code></pre>