MySQL值为true,检查为true

时间:2015-05-03 20:16:46

标签: php html mysql

你好,我想做一些想法:

启用MySQL =是或否。

/**
 * Counts the number of cards in each suit and will add points
 * for the suits value, so if 3 or more suits zero points,
 * 2 suits 1 point, 1 suit 2 points, 0 suits 3 points
 */
public int countDistributionPoints()
{
    int countPoints = 0;
    int count = 0;

    for (int i = 0; i < cards.length; i++) {
        char suit = cards[i].getSuit();

        if (cards[i].getSuit() == 'C')
            count++;
        else if (cards[i].getSuit() == 'D')
            count++;
        else if (cards[i].getSuit() == 'H')
            count++;
        else if (cards[i].getSuit() == 'S')
            count++;

        if (count >= 3)
            countPoints = 0;
        else if (count == 2)
            countPoints++;
        else if (count == 1)
            countPoints += 2;
        else if (count == 0)
            countPoints += 3;
    }

    return countPoints;
}

这可能吗?我知道我可以使用if(),但我想用其他方式。还有其他方法吗?

1 个答案:

答案 0 :(得分:0)

是的,有可能...... 你应该像这样使用array

function one(){
<input type="radio" name="MyName" value="yes" checked="checked" />Yes <input type="radio" name="MyName" value="no" />No 
}
function two(){
<input type="radio" name="MyName" value="yes" />Yes <input type="radio" name="MyName" value="no" checked="checked" />No
}

$arr=array(
    'yes'=>'one',
    'no'=>'two'
);

$arr[$enable]();