PHP includes several functions that can determine the type of variable, such as: GetType (), Is_array (), Is_float (), Is_int (), Is_object (), and is_string ().
Copy the Code code as follows:
$s = "This is a string";
$i = 9;
$arr = Array (2,4,6);
Is_string ($s); Returns true, indicating that $s is a string variable
Is_string ($i); Returns false, indicating that $i is not a string variable
Is_array ($arr); Returns True, indicating that $arr is an array
Is_array ($s); Returns false, indicating that $s is not an array
$str = "This is a string";
$int = 9;
$bool = FALSE;
The type of echo "\ $str is:". GetType ($STR);
echo "
";
echo "
";
The type of echo "\ $int is:". GetType ($int);
echo "
";
echo "
";
The type of echo "\ $bool is:". GetType ($bool);
?>
The above describes the variable type PHP judgment variable type implementation code, including the content of the variable type, I hope that the PHP tutorial interested in a friend helpful.