Php basic statement variable symbol, php basic statement variable
Central topic
Mark and comment
//
/**/
Output statement
Echo output
Echo can output multiple strings separated by commas (,).
Print Output
Print can only output one string, returns true or false
Print_r ()
Strings and numbers can be simply printed out, while arrays are displayed in the form of an enclosed key and a list of values, starting with Array.
Var_dump ()
Output type
Data Type
Weak Language
Gettype ()
Judge type is _ type name ()
Variable definition
$ Variable name = Value
Super global variable $ GLOBALS
Variable
Isset ()
Variable definition?
Unset ()
Clear variable
Empty ()
Determines whether the variable is null.
& Get address
Type conversion
(Data Type) Variable
Type conversion settype (variable name, type)
Operator expression
Mathematical Operators
+
-
*
/
%
++
--
+ =
-=
String
Concatenate a string with vertices.
Comparison Operators
><>==! =
Logical operators
And &&
Or |
!
Others
@ (Error control operator)
Ternary Operators
? :
Judgment condition? :
Statement
Branch
If... else
Switch... case
Loop
For
While
Function
Definition
Four Elements
Use
Common
Random number generator rand ()
Current Time
Time ()
Date ()
Strtotime ()
Convert datetime to UNIX Timestamp
Set Time Zone
Date_default_timezone_set ('prc ')
Date. timezone = Europe/Paris changed to Etc/GMT-8
Format the date and time
Date ()