PHP Data type and judgment variable type

Source: Internet
Author: User
PHP Data types include string, integer, floating point number, Boolean, array, object, and NULL. Use the var_dump function to determine the variable type. The var_dump function is used to determine the type and length of a variable and output the value of the variable. if the variable has a value, it is the value of the variable and returns the data type. PHP Data types include string, integer, floating point number, Boolean, array, object, and NULL.

Use the var_dump function to determine the variable type.
The var_dump function is used to determine the type and length of a variable and output the value of the variable. if the variable has a value, it is the value of the variable and returns the data type.

Java code

$ Val1 = 1;

$ Val2 = 3.14;

$ Val3 = 'Who Asked You. ';

$ Val4 = array ('AAA', 'BBB ');

$ Val5 = true;

$ Val6 = function (){};

$ Val7 = null;

Var_dump ($ val1); // integer

Echo'
';

Var_dump ($ val2); // floating point number

Echo'
';

Var_dump ($ val3); // string

Echo'
';

Var_dump ($ val4); // Array

Echo'
';

Var_dump ($ val5); // boolean

Echo'
';

Var_dump ($ val6); // object

Echo'
';

Var_dump ($ val7); // NULL

?>

:

PS: Since the encoding used is UTF-8, a Chinese character occupies 3 bytes while an English character occupies 1 byte.

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.