Chapter 4 _ PHP basic syntax _ PHP Tutorial

Source: Internet
Author: User
Chapter 4-basic PHP syntax. 1. the first PHP program ?? 2. PHP supports eight basic data types, including four scalar types: boolean, integer, float, and s 1. first PHP program

  
 

2. PHP supports eight basic data types, including four scalar types: boolean, integer, float, and string ), two composite types: array and object. two special types are available: resource and NULL)

3. the var_dump function can be used to print information about variables.

 
 

4. integer type.

In 32-bit operating systems, the valid range of integer numbers is-2147483648 ~ + 2147483647. If this range is exceeded, it will be interpreted by the PHP engine as a floating point number (float ).

Add 0 in octal and 0x in hexadecimal notation (0 rather than letter O)

 
 

5. string type

There are three methods for defining strings: single quotes ('), double quotes ("), and delimiters (<). The difference between the first two is that if a string contains a variable name, the variable name in double quotation marks will be replaced by the actual value, and the variable name in single quotation marks will be directly output according to common characters.

 
 '"My name, "?>

Use the following delimiters:

 
 

6. object type

 
 Name =-> age = 'My name is '.-> name .'
I am '.-> age.' years old '= Person ("kimi", 5->?>

7. type conversion

  Print_r ()Displays easy-to-understand information about a variable. If the value is string, integer, or float, the variable value is printed. If array is provided, keys and elements are displayed in a certain format.

  

 
 "          ='Kimi'     =()      '

' ( ='Cindy' =() '

' ( ?>

Why? "? 2. PHP supports eight basic data types, including four scalar types: boolean, integer, float, and s...

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.