PHP variables and basic syntax integral type

Source: Internet
Author: User

Course Outline
First, Content Introduction
1. Variables/Constants
2.php data types and basic syntax

Second, learning objectives
1. Master the common data types in PHP
2. Master the basic syntax of PHP
3. Fully understand variables and constants
--------------------------------------------------------------------------------------------------------

PHP Basic Syntax
1.html and PHP Mixed
2. A statement with; (semicolon ends)
3. How to set a variable, and the use of variables
4. The data type of the variable is not invariant
5.php is a weak data type programming language
6.php Case Sensitive
7. A valid variable name is preceded by a letter, a number, an underscore, followed by any number of alphanumeric underscores.

PHP Basic Syntax Enhancement
The data type of 1.php variables is variable, it is determined by context, so it is weak type language;
2.var_dump can view the data type of a variable
3. Define a variable to start with a $ symbol
4.php variables do not start with numbers and keywords, you can start with a number, an underscore

Three types of PHP data
          1. Basic data Types
    1.1 shaping
    1.2 Decimal (floating number) contains single-precision and double-precision
    1.3 Boolean type (True and false)
    1.4 string
           2. Composite data Types
   2.1 Arrays Array
   2.2 objects Object
           3. Special Data type
   3.1 null
   3.2 Resource Type (Resource) For example: $con =mysql_connect ("localhost", "root", "root") ;

PHP Data Three types of details Introduction
 1. Integer values can be in decimal, hexadecimal 0x, or octal 0, which is preceded by
    $a = 1234;//decimal number
     $a =-123; Negative
    $a = 0123;//Eight binary (equals decimal 83 )
    $a = 0x1a;//hexadecimal number (equals decimal =  10* 16 of 0 Square +1*16)
 2. PHP does not support unsigned integers, which means that integers in PHP are signed
 3. The length of the shaping number is related to the platform, usually (4 bytes signed). The word length of the Interger value can be expressed as a constant php_int_size, and the maximum value can be represented by a constant php_int_max.
     Illustration:
                 echo php_int_size;   ------4
                  echo Php_int_max;    -----2147483647    2 of the 31-square minus 1, the first bit is the sign bit
 4. If a given number exceeds the range of Interger, it will be interpreted as float
   $large _number= 2147483647;
  var_dump ($large _number);------------------float

5. $a how =2 is stored in the computer
00000000 00000000 00000000 00000010

Use the case to parse the form of the variable that exists in memory:
<?php
$a; If you write only $ A, but there is no assignment, how much is a $ A?
echo $a;
Vam_dump ($a) result is null
?>

PHP variables and basic syntax integral type

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.