PHP includes several functions that can determine the type of variables, such as: gettype(), is_array(), is_float(), is_int(), is_object() and is_string().
Copy code The code is as follows:
$s = "this is a string";
$i = 9;
$arr = array(2,4,6);
is_string($s); //Return 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, Indicates that $s is not an array
$str = "this is a string";
$int = 9;
$bool = FALSE;
echo "The type of $str is: ".gettype( $str);
echo "
";
echo "
";
echo "The type of $int is: ".gettype($int);
echo "
";
echo "
";
echo "The type of $bool is: ".gettype($bool);
?>
http://www.bkjia.com/PHPjc/320751.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320751.htmlTechArticlePHP includes several functions to determine the type of variables, such as: gettype(), is_array(), is_float() , is_int(), is_object() and is_string(). Copy the code The code is as follows: ?php $s = "th...