如何否定这个if / else比较呢? [英] How do I negate this if/else comparison to just if?
本文介绍了如何否定这个if / else比较呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试隐藏类,除非满足两个因素。目前,我正在使用以下代码:
I'm trying to set the class hidden, unless two factors are met. Currently, I'm using the code below:
<?php
if (isset($_POST['prerequisite']) && $form == "CheckingIn")
{
}
else
{
echo "hidden";
}
?>
如何将其修复为if语句而不是if / else?
How can I fix this to just be an if statement instead of an if/else?
推荐答案
否定表达;使用NOT逻辑运算符:
Negate the expression; use the "NOT" logical operator:
if (!(isset($_POST['prerequisite']) && $form == "CheckingIn")) { echo "hidden"; }
(注意!符号)
在此处阅读更多内容: http://php.net /manual/en/language.operators.logical.php
Read more here: http://php.net/manual/en/language.operators.logical.php
这篇关于如何否定这个if / else比较呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文