PHP code used to determine the variable type. PHP includes several functions to determine the type of a variable, such as gettype (), is_array (), is_float (), is_int (), is_object (), and is_string (). Copy the code as follows :? Php $ something PHP includes several functions to determine the type of a variable, such as gettype (), is_array (), is_float (), is_int (), is_object (), and is_string ().
The code is 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;
Echo "\ $ str:". gettype ($ str );
Echo"
";
Echo"
";
Echo "\ $ int type:". gettype ($ int );
Echo"
";
Echo"
";
Echo "\ $ bool type:". gettype ($ bool );
?>
The http://www.bkjia.com/PHPjc/320751.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320751.htmlTechArticlePHP includes several functions that can determine the type of a variable, such as gettype (), is_array (), is_float (), is_int (), is_object (), and is_string (). The code is as follows :? Php $ s = "th...