Basic PHP knowledge-1. Basic syntax, basic knowledge basic syntax
To be continued ......
I. Introduction to PHP
Ii. PHP development environment Configuration
Iii. PHP syntax
1. PHP scripts can be placed anywhere in the document? Php, starting with?> End:
<? Php // here is the PHP code?>
The default file extension for PHP files is ". php"
<!doctype html>
2. PHP three annotation Methods
<! DOCTYPE html> <body> <? Php // This is a single line comment # this is also a single line comment/* multiple lines comment block across multiple lines */?> </Body>
3. Case sensitivity in PHP
In PHP, all user-defined functions, classes, and keywords (such as if, else, and echo) are case insensitive.
<! Doctype html>
Iii. PHP Variables
1. Create a variable
Php creates a variable without a keyword. A variable is created when it is assigned a value for the first time and starts with the $ symbol and is followed by the variable name;
2. variable scope
Local: variables declared within the function have LOCAL scopes and can only be accessed within the function.
Global: variables declared outside the function have a Global scope and can only be accessed outside the function.
Static scope (static): static scope has a static scope when the function is destroyed or deleted after it is executed, and the variable still exists after the function is executed.
3. variable naming rules (PHP variable names are case sensitive !)
- The variable starts with the $ symbol, followed by the variable name
- The variable name must start with a letter or underscore
- The variable name cannot start with a number.
- Variable names can only contain letters, numbers, and underscores (A-z, 0-9, and _)
- Variable names are case sensitive ($ y and $ Y are two different variables)
Data Type
Operator
Process Control