与&& amp; ,!=和||在PHP中

时间:2013-05-07 17:13:34

标签: php

我只是想知道如何在不改变success条件的情况下将if (.....)作为回声。我需要添加更多条件或任何函数或数组?只是一个小困惑写现在谢谢。只是想知道它是否会以这种方式工作,或者我必须为这种情况编写大代码:)

$petbuyer1 = 1;
$petbuyer2 = 2;
$petbuyer3 = 3;
$user_id = 1;
$petfom = "fomyes";
$fomon = "fomyes";

if (($petfom == $fomon) && ($user_id == $petbuyer1 || $user_id == $petbuyer2 || $user_id == $petbuyer3)) {
    echo "failed";
}else{
    echo "success";
}

也尝试过:

if (($petfom == $fomon) && ($user_id != $petbuyer1 || $user_id != $petbuyer2 || $user_id != $petbuyer3)) {
    echo "failed";
}else{
    echo "success";
}

1 个答案:

答案 0 :(得分:2)

似乎是$fomom的拼写错误。可能是$fomon