PHP Basic Tutorial PHP data type

Source: Internet
Author: User
Tags type null
This section introduces PHP data types for you to learn about.

Syntax: integer values can be expressed in decimal, hexadecimal, or octal, preceded by an optional symbol (-or +). Octal indicates that the number must be preceded by 0 (0), and hexadecimal indicates that the number must be preceded by 0x.

Example 1,

 
      "Echo Php_int_max;echo"
";//integer maximum number (2147483647) $fmax =2147483648;var_dump (Php_int_max); A number that exceeds the range of integers will be interpreted as a float type. echo "
"; Var_dump ($fmax);? >

Floating-point numbers: floating-point numbers (double-precision or real numbers)

 
      

Important understanding: The accuracy is calculated from the first non-0 number that begins on the left. The Boolean type is the simplest type in PHP. It can have a value of TRUE or FALSE. Such as:

 
      True when the output value is: ". $foo 1; Output 1

Details: When converting to Boolean, the following values are considered False:1, the Boolean FALSE itself 2, the integer value 0 (0) 3, the floating-point value 0.0 (0) empty string, and the string "0" 4, the array without any elements 5, not package Object with any member variable (PHP 4.0 only) 6, special type NULL (including variables not yet set) 7, SimpleXML object generated from an XML document without any tags (tags)

 
      "; Var_dump ((bool) array ()); if ($a ==false) {echo" null 0 default conversion to FALSE, success!) ";} Else{echo "cannot be converted to false";}

Output: BOOL (FALSE) bool (FALSE) NULL 0 default conversion to FALSE, success!

Thank you for your attention to the PHP introductory tutorial, this series of basic PHP tutorial will help PHP novice friends, quickly master the language of PHP programming. The programmer's home will continue to introduce PHP-related tutorials For everyone, I wish you all the progress of learning!

  • 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.