Determine the relationship between 0 and ', null, empty, False
$a = 0;
The relationship between echo "0 and", empty, NULL, false: ";
if ($a = = ") {
echo "0 = ="; ";
}else{
echo "0! ="; ";
}
if (trim ($a) = = ") {
echo "Trim (0) = ="; ";
}else{
echo "Trim (0)! ="; ";
}
if (strval ($a) = = ") {
echo "Strval (0) = ="; ";
}else{
echo "Strval (0)! ="; ";
}
if ($a = = =) {
echo "0 = = ="; ";
}else{
echo "0!=== ';";
}
if (empty ($a)) {
echo "0 is empty;";
}else{
echo "0 is not empty;";
}
if (Is_null ($a)) {
echo "0 is null;";
}else{
echo "0 is not null;";
}
if (Is_numeric ($a)) {
echo "0 is numeric;";
}else{
echo "0 is not numeric;";
}
if (is_string ($a)) {
echo "0 is string;";
}else{
echo "0 is not string;";
}
if (! $a) {
echo "0 is false;";
}else{
echo "0 is not false;";
}
Determine the relationship between ' and 0, null, empty, False
$a = ";
The relationship between echo "' and 0, empty, NULL, false:";
if ($a = = 0) {
echo "' = = 0;";
}else{
echo "'! = 0;";
}
if (intval ($a) = = 0) {
echo "Intval (') = = 0;";
}else{
echo "Intval (')! = 0;";
}
if (empty ($a)) {
echo "is empty;";
}else{
echo "is not empty;";
}
if (Is_null ($a)) {
echo "' is null;";
}else{
echo "is not null;";
}
if (Is_numeric ($a)) {
echo "is numeric;";
}else{
echo "is not numeric;";
}
if (is_string ($a)) {
echo "is string;";
}else{
echo "is not a string;";
}
if (! $a) {
echo "is false;";
}else{
echo "is not false;";
}
Determine the relationship between null and ', 0, empty, false
$a = null;
echo "null and", 0, empty, false the relationship between: ";
if ($a = = ") {
echo "NULL = ="; ";
}else{
echo "Null! ="; ";
}
if ($a = = 0) {
echo "NULL = = 0;";
}else{
echo "Null! = 0;";
}
if ($a = = =) {
echo "NULL = = ="; ";
}else{
echo "null!==="; ";
}
if ($a = = = 0) {
echo "NULL = = 0;";
}else{
echo "null!=== 0;";
}
if (strval ($a) = = ") {
echo "strval (null) = ="; ";
}else{
echo "Strval (NULL)! ="; ";
}
if (intval ($a) = = 0) {
echo "intval (null) = = 0;";
}else{
echo "intval (NULL)! = 0;";
}
if (empty ($a)) {
echo "null is empty;";
}else{
echo "NULL is not empty;";
}
if (Is_numeric ($a)) {
echo "NULL is numeric;";
}else{
echo "NULL is not numeric;";
}
if (is_string ($a)) {
echo "NULL is string;";
}else{
echo "NULL is not string;";
}
if (! $a) {
echo "NULL is false;";
}else{
echo "NULL is not false;";
}
echo "";
The result of the output is:
I think the output can be clear to solve the empty string, 0, null, empty and false between the approximate relationship, in the development process of flexible use of the above code method, coupled with good logic, basically should be no problem.
The above describes the PHP hollow string introduction 0, NULL, empty and false relationship between, including the aspects of the content, I hope to be interested in the PHP tutorial friends helpful.