Today do information collection page encountered a strange problem, study for a long time to find the root cause of the problem, it is a bit strange indeed.
(the younger brother often uses the C #, Java and other languages, PHP only occasionally in use, not research very deep). Please senior PHP programmer don't laughed at
The problem is this: in PHP statements (0!=null && 0 >=0), the returned result is empty, which is really very strange.
Experiment Summary:
The PHP statements are 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). "
";//
Results:
a:0
B:
c:1
D:
Visible: The result of 0!=null is empty. To make the results correct, you can modify the $index!=null to Isset ($index)
if (Isset ($index) && $index >=0))
{
echo "contains.";
}else{
echo "does not contain.";
}
This is very strange, finally solved. Mark, please.
Address of this article: