For php basic questions, please give me some advice. Is it wrong? $ C & nbsp; 10; if & nbsp; ($ a & nbsp; & gt; & nbsp; 0) & nbsp; + & nbsp; ($ B & nbsp; & gt; & nbsp; 0) & nbsp; + & nbsp; ($ c & nbsp; & gt; & nbsp; 0) & nbsp; + & nbsp; ($ d & gt; & nbsp; 0) & nbsp ;! & For php basic questions, please give me some advice. Am I wrong?
$ C = 10;
If ($ a> 0) + ($ B> 0) + ($ c> 0) + ($ d> 0 )! = 1 )){
Message ('success ');
} Else
{
Message ('failed ')
}
Excuse me, why does $ c 10 fail to be output in the if statement ?? How can this problem be solved? A, B, and d are all empty. isn't it so understandable ($ c> 0) that c is returned,
C is 10, so c! = 1
Shouldn't the output be successful?
I think this is my misunderstanding. please give me some advice. thank you.
------ Solution --------------------
$ C = 10;
If ($ a> 0) + ($ B> 0) + ($ c> 0) + ($ d> 0 ))! = 1 )){
Message ('success ');
} Else
{
Message ('failed ')
}
------ Solution --------------------
error_reporting(E_ALL ^ E_NOTICE);
$c = 10;
echo ($a > 0) + ($b > 0) + ($c > 0) + ($d> 0);
Output 1
So if ($ a> 0) + ($ B> 0) + ($ c> 0) + ($ d> 0 )! = 1) {not valid (1! = 1)
Therefore, take the else branch
------ Solution --------------------
$ C = 10;
If ($ a> 0) + ($ B> 0) + ($ c> 0) + ($ d> 0 )! = 1 )){
$ A is not defined, so ($ a> 0) false is returned, int type is 0
$ B is not defined, so ($ B> 0) false is returned, int type is 0
$ C = 10, so (10> 0) returns true, where int type is 1.
$ D is not defined, so ($ d> 0) false is returned, int type is 0
After the sentence is repeated, it becomes
If (0 + 0 + 1 + 0 )! = 1 ){