PHP variable type implementation code _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.