Data Types in php

Source: Internet
Author: User

 

Data Type

 

PHP only has three basic data types: integer, floating-point number (or real number, double-precision number), and string. Strings can be enclosed in single quotes and double quotes, but they have different meanings: variables can only be used in double quotes.

 

Variable

 

You must add "$" before the variable. You do not need to specify (or define) The type of the variable before using the variable. You can assign values to the same variable for different types of data. However, to use a global variable, use the global description (or add it to the $ GLOBALS [] array ). Static variables must be used.

 

Array

 

You can use an array directly without specifying its type and size. Each element of the same array can have different data types.

 

Operator

 

Generally, operators in the C language are retained. Added the string connector "." (used to access object members "-> "). Added the "=>" operator to assign initial values to the array. In addition, logic and ("&") and logic or ("|") are also available "and" and "or", adding logical differences or "xor"

 

Basic statement

 

Master the if-else statements, switch-case statements, for statements, while statements, do-while statements, continue statements, and break statements. The require and include statements are used to insert a disk file.

 

Function Definition and usage

 

You do not need to specify the function type and parameter type when using the function to define a function.

 

Function Name (parameter 1, parameter 2 ,......)

{Statement 1;

Statement 2 ;......

}

 

From the bing7599069 Column

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.