PHP variable type, variable detection

Source: Internet
Author: User
Variable type of 1.PHP: Integer floating-point string Boolean Array object null resource type A variable is a box, the type can be seen as the label of the box, the value of the variable is the contents of the box null is no type of empty box, only one value is Null2 . The detection of variables:

  

The detection of the variable if (isset ($b)) {    echo ' variable b exists ';    } else{    echo ' variable B does not exist ';        }

Isset () is used to detect if a variable is set, returns a Boolean value,

Returns False if the variable is not assigned or the assignment is null, or True if it is not assigned to a value

3. Detection of variable types:

  

Gets the variable type $ A = 1;echo ' GetType ($a) ';//Determine if the variable is the desired type//Is_int,    is_float,    is_array ... $a = 23if (Is_int ($a)) {        Echo ' A is an integral type ';    } else{        Echo ' A is not an integral type ';    }        

  

PHP variable type, variable detection

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.