Home > Backend Development > PHP Tutorial > Data types in php_PHP tutorial

Data types in php_PHP tutorial

WBOY
Release: 2016-07-13 17:47:51
Original
1089 people have browsed it

Data type

PHP has only three basic data types: integers, floating point numbers (or real numbers, double precision numbers) and strings. Strings can use single quotes and double quotes, but they have different meanings: variables can only be used within double quotes.

Variable

"$" should be added in front of the variable. There is no need to specify (or define) the type of the variable in advance when using the variable. Different types of data can be assigned to the same variable. But if you want to use global variables, you must use global instructions (or add them to the $GLOBALS[] array). To use static variables, use static instructions.

Array

When using an array, you do not need to specify its type and size, you can use it directly. Elements of the same array can have different data types.

Operator

The C language operators are generally retained. Added string concatenation character "." (use "->" when accessing object members). Added "=>" operator, used to assign initial value to array. In addition, logical AND ("&&") and logical OR ("||") can also be used with "and" and "or", adding logical exclusive OR "xor"

Basic sentences

It is required to master the if-else statement, switch-case statement, for statement, while statement, do-while statement, continue statement, and break statement. require statement and include statement, used to insert a disk file

Definition and use of functions

Use function to define a function without specifying the function type and parameter type.

function function name (parameter 1, parameter 2,...)

{ Statement 1;

Statement 2;......

}

Excerpted from bing7599069’s column

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478486.htmlTechArticleData type PHP has only three basic data types: integers, floating point numbers (or real numbers, double precision numbers) and strings type. Single and double quotes can be used in strings, but have different meanings: only...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template