gpt4 book ai didi

php - 使用 if 和 else 时 AND 运算符的否定是什么?

转载 作者:行者123 更新时间:2023-12-04 14:23:34 25 4
gpt4 key购买 nike

我将 if&& 一起使用,else 紧随其后。

示例:

$Name = "john";
$age = "30";

如果我这样做:

if($Name =="john" && $age=="30") 
{ some stuff }
else { do other stuff }

这里的其他意思是:$Name !="john"&& $age != "30" ??我对此有点困惑。

谢谢

最佳答案

$Name == "john";
$age == "30";

if($Name =="john" && $age=="30")
{
// Here comes only when name is john and age is 30
}
else
{
// Here comes all the time when name is not john AND age is not 30
// If age is 30 and name is not John then comes here
// If age is not 30 and name is John then comes here
}

关于php - 使用 if 和 else 时 AND 运算符的否定是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36472770/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com