1. Distinction between null,0 and voidness
(1) The distinction between 0 and NULL
<?php $a = 0;if ($a = = ") {echo ' This judgment condition cannot be distinguished ';} else{Echo ' This judging condition can be differentiated ';}?>
<?php $a = 0;if ($a = = = ") {echo ' This judging condition cannot be distinguished ';} else{Echo ' This judging condition can be differentiated ';}?>
<?php $a = 0; $b = ", if (empty ($a) && empty ($b)) {echo ' This judgment condition cannot be distinguished ';} else{Echo ' This judging condition can be differentiated ';}? >
<?php $a = 0; $b = ", if (!is_null ($a)) && (!is_null ($b))) {echo ' This judgment condition cannot be distinguished ';} Else{echo ' This judging condition can be differentiated ';}?>
<?php $a = 0; $b = ", if (isset ($a) && isset ($b)) {echo ' This judgment condition cannot be distinguished ';} Else{echo ' This judging condition can be differentiated ';}?>
Conclusion: 0 and NULL can only be used to determine the difference between = = =.
(2) The distinction between null and void
<?php $a = ", if ($a ==null) {echo ' This judging condition cannot be distinguished ';} Else{echo ' This judging condition can be differentiated ';}?>
<?php $a = ", if ($a ===null) {echo ' This judging condition cannot be distinguished ';} Else{echo ' This judgment condition can be differentiated ';} ?>
<?php $a = '; $b = null;if (Empty ($a) && empty ($b)) {echo ' This judgment condition cannot be distinguished ';} Else{echo ' This judgment condition can be differentiated ';}? >
<?php $a = "; $b = Null;if (Is_null ($a)) {echo 1;} Else{echo 2;} if (Is_null ($b)) {echo ' <br/>a ';} Else{echo ' B ';}?>
<?php $a = "; $b = Null;if (isset ($a)) {echo 1;} Else{echo 2;} if (Isset ($b)) {echo ' <br/>a ';} Else{echo ' <br/>b ';}?>
Conclusion: The distinction between null and void can use ===,is_null,isset.
(3) distinction between 0 and NULL
<?php $a = 0;if ($a ==null) {echo ' This judging condition cannot be distinguished ';} Else{echo ' This judgment condition can be differentiated ';}? >
<?php $a = 0;if ($a ===null) {echo ' This judging condition cannot be distinguished ';} Else{echo ' This judgment condition can be differentiated ';}? >
<?php $a = 0; $b = null;if (Empty ($a) && empty ($b)) {echo ' This judgment condition cannot be distinguished ';} Else{echo ' This judgment condition can be differentiated ';}? >
<?php $a = 0; $b = null;if (Is_null ($a)) {echo 1;} Else{echo 2;} if (Is_null ($b)) {echo ' <br/>a ';} Else{echo ' <br/>b ';}? >
<?php $a = 0; $b = null;if (isset ($a)) {echo 1;} Else{echo 2;} if (Isset ($b)) {echo ' <br/>a ';} Else{echo ' <br/>b ';}? >
Conclusion: The distinction between 0 and null can be used ===,is_null,isset.
In summary, we distinguish 0, null and NULL when the preferred = = = Method, simple and practical fast. No factor group conversions cause errors in data type changes.
Some tips on PHP programming