PHP two

Using PHP

Portability: cross-platform development language.

Low cost: open-source development language, you can view its source code, free to use, modify, and publish again.

It supports multiple databases: MySQL PostgreSQL Oracle, MongoDB, MSSQL, SQLite.

Object-oriented support: abstract classes, interfaces, constructors, destructors.

 

PHP variables

Variable is a temporary space to store data. Such as: $ name = "fairy";

Variable naming rules:

This variable can contain: uppercase and lowercase letters, numbers, underscores.

php variable declaration is not required in advance, you can use direct assignment.

php variable can not start with a number; eg: $ 78jj = 900 // illegal variable name

Php variable names can be keyword; such as: $ true = 200;

Variable names are case sensitive

Variable names to be meaningful.

There are four kinds of unlikely php variable scope:

local   global  static  parameter

 

 

php variable data types

PHP and JS, the type of a variable, depending on what the value of poetry.
Data type JS of:
(1) the basic data types: String, Boolean, Number, null, undefined
(2) complex data types: array, object, function
data type in PHP:
(1) the basic data type (4): int (integer), float (float), boolean (Boolean), string (character)
(2) complex data type (2): array (array), object (object)
(3) special data types ( 2): resource (resources), NULL (empty)
resource type: can be understood, the result of access to external files returned.
 For example: PHP connect to the database, PHP create image files.

NULL type

NULL type: Only one value is NULL, no variable represents the assignment. The following cases on behalf of NULL.

$ G = NULL; // NULL value variable assignment

unset ($ g) // delete a variable

Only two Boolean values ​​true and false.

Digital Type 

Integer: refers to integer, 10, 200, -200, -23

Float: refers to the decimal point, 90,23.90 -90, 89

Character

1) single quotation marks, can only be used in single quotes \ ', \\
  example: $ name =' Beijing ';
(2) double quotation marks, double quotes may be used in all the escape character.
  For example: $ name = "Beijing";
(. 3) heredoc manner: long text can be saved
 heredoc syntax as
 $ STR = <<< the EOF
 // write a lot of content can be intermediate
the EOF;

Guess you like

Origin www.cnblogs.com/zhangzongke/p/11403596.html