Home > Article > Backend Development > First introduction to php_PHP tutorial
PHP: Hypertext Preprocessor (Hypertext Preprocessing Language), server-side script.
1. Opening and closing tags, there are 2 common php tags:
and
2. Note: Almost the same as ordinary language
3. Data type:
Four scalar types: boolean, integer, float (also called double), string
boolean: zero or empty is false, others are true
string: A character is a byte, and there are four definition methods.
Two composite types: array, object
array: key value collection, only integer and string can be used as keys
object:
Two special types: resource, NULL
resource: Resource is a reference to an external resource.
Variable definitions do not support explicit type definitions, which are determined by PHP at runtime based on the context in which the variable is used.
4.Variable
dollar match + variable name, case sensitive
Variable variables look similar to two-dimensional arrays, but I didn’t look carefully.
Magic constant, sounds very special.
5. Control structure
if-else: Same as high-level language, but with alternative syntax. It is not required to master, but you should understand the code
while, for: loop
break ends the execution of the current for, foreach, while, do-while or switch structure. break can accept an optional numeric argument to determine how many loops to break out of.