doufu8588 2013-09-09 01:15
浏览 16
已采纳

阵列不工作?

$values = array('0', 1, 2);
if (in_array($values2, $values, false) || $values2 == 0) {

Values2 is the submitted value, and in this case it was 3, 3 isn't in the array, so shouldn't the if condition execute?

  • 写回答

2条回答 默认 最新

  • dongqiao8421 2013-09-09 01:26
    关注

    To check if the value is not in the array, use the aptly named not operator:

    if (!in_array($values2, $values, false) || $values2 == 0) {
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?