<?php PHP Embedded Statement?>
PHP comments are basically the same as HTML
Single-line Comment
/* Content * * Multi-line Comment
Output statement
Echo can sequentially output multiple strings separated by commas
Print can only output one string at a time, not multiple outputs at a time
Way, method
Print_r (array) print array
Var_dump () Output variable (type, length, etc.), commonly used to test a variable
Data type
Shaping int
Decimal and List precision floating-point number float double-precision floating-point numbers double and decmial digits after decimals can be defined
Character class char strings string
boolean bool can only output true or flase
Date Time datetime general PHP No
Object Type objects
Defining variables
$a variable A
Type conversions
$a = (type) $a cast to a type
Settype (variable, "type") sets the variable to a type
A method of variables
is set (variable) determines whether a variable is defined to be defined to return true without a defined return flase
unset (variable) Clear variable
Empty (variable) to determine if the variable is empty NULL returns true non-null return flase Note Assignment is 0 or an empty string is equivalent to null
& Fetch Address $a = 10; $b =& $a means to give the address of the A variable to B because they share an address, so one of the variables changes the other.
Variable variable $a = "Hello"; $hello = "Hello"; echo $ $a will output hello PHP dedicated other use will error
Definition of a string
\+ content backslash plus content transfer character \r,\n represents line break
$a = "Hello"; $b = ' Hello '
The escape character can be parsed in double quotation marks, and single quotation mark can not
Double quotation marks can parse the variable but when parsing the variable to put the variable into {}, otherwise there may be an error single quotation mark can not
PHP stitching strings with. (dot) stitching
PHP Basic Statement