In php syntax, 0 is not equal to null. the solution encountered a strange problem during the information collection page today. after studying for a long time, I found the root cause of the problem, which is indeed a bit strange.
(The younger brother often uses C #, java, and other languages. php is only used occasionally, but not deeply researched ). Don't laugh at senior php programmers
The problem is: in the php statement (0! = Null & 0> = 0), the returned result is null, which is really strange.
Experiment summary:
The php statement is as follows:
$ Index = 0;
Echo "A:". $ index ."
"; // 0
Echo "B:". ($ index! = Null & $ index> = 0 )."
";//
Echo "C:". (isset ($ index) & $ index> = 0 )."
"; // 1
Echo "D:". (0! = Null )."
";//
Result:
A: 0
B:
C: 1
D:
Visible: 0! = Null: The result is null. to make the result correct, you can change it to $ index! = Null to isset ($ index)
If (isset ($ index) & $ index> = 0 ))
{
Echo "include .";
} Else {
Echo "does not contain .";
}
This is very strange and finally solved. Mark.
Address: