设置复选框初始状态以检查服务器端是否满足某些条件

How to can I check a checkbox by default if some condition is met?

if ($php = "yes"){
    // check.box is check
} 
<?php
            $checked = ""; 
            if ($php == "yes"){   
                 $checked = "checked"; 
            } 
 ?>
<input type="checkbox" <?php echo $checked;?>/>

Try this:

<input type="checkbox" <?=($php == "yes")? 'checked' : '';?>/>