$a =null;
Var_dump ($a);
$b = 2;
Var_dump ($b);
Var_dump (Isset ($c));//isset detects if a variable exists but when detecting it, be aware that NULL is also returned as false.
There are many types of detection variables you can use GetType to detect what type of variable it is, but it is not recommended to use slow and useful is_** to detect whether a variable is a specified type
$a =null;
Echo GetType ($a);//return NULL
$a = 12;
Var_dump (Ia_int ($a));//return bool
Topic
$b = "I am a string";
if (is_string ($b)) {
echo "I'm a string"
}else{
Echo ' NO ';
}
$b = 222;
if (is_string ($b)) {
Echo ' I am a string ';
}else{
Echo ' I'm not a string ';
}
Conversion math operators for string-to-integer
$a = 5;
$b = "6hello";
$c = $a + $b;
Var_dump ($c); returns INT (11)
Numeric to string conversion concatenation operator
$a = 6;
$b = ' Hello World ';
$c = $a. $b;
Var_dump ($c)//return string (6hello world);
Conversion comparison operator for numeric array strings to Boolean values
An empty string of 0 0.0 null array () False returns a Boolean value of False
Detects if the variable is empty
$a = 23;
Var_dump (Empty ($a));//Returns a Boolean of false, NULL returns a Boolean value of True NOT NULL returns false
PHP Basics: Variable Detection