The main reason to write this is the last week after a typo error, but this is the correct standard grammar, will not produce syntax error, so bad Chase, and then make a record, then you can first grep to see if this typo error caused. Xd
Possible spelling mistakes in PHP if judgment
If the judgement type, there is a very common, but that is not typo error, but also very often such a written, is "=", "= =", "= =".
Example
View Raw Code?
<?php
if ($a = ' a ')
Echo ' This line is printed because $a = "a", and a is not 0/false, so it is true;
if ($a = = ' B ')
Echo ' This line will not be printed, because $a is equal to "a", not equal to "B";
if ($a = = true)
Echo ' This line will not be printed because the $a form is not true. (Of course the main value is wrong, but not discussed here) ';
?>
When in the program, accidentally delete the equal sign, it will cause great tragedy. (syntax is not checked out, is the correct wording)
The above is common, also difficult to chase, but the following is written for the first time met ~ (the "!=" into "=!", this should be 90% 9 is typo error.)
View Raw Code?
<?php
$a = ' B ';
if ($a!= ' a ')
echo $a; This line printed out ' B ', this is the thing to do.
When the!= hit =! , it will cause tragedy.
if ($a =! ' A ')
Echo ' This line will not be printed ';
Var_dump ($a); Print out false
?>
Problem Tracking Disassembly
Step by step decomposition $a =! A
$a =! ' Boolean of a '//' A ' is true,!true = False.
$a = False
So if ($a = false), will never fall into this row, syntax is also legal.
After Debug in addition to "=", "= =", "= = =" Outside, to pay more attention to see "!=" and "=!" of the wording.