php basis - syntax, variable

A, php syntax:
1, php language need to write in <? Php?> Tags inside
2, php end of each line required language; as terminator
3, php is a weak language, does not require you to declare variables
4, can be nested in the HTML language and js
5, case-sensitive, require strict case-sensitive
 
Two, php variable:
1, the beginning of the use of letters or an underscore _
2, only letters, underscores, numbers, combinations
3, variable names begin with a $ sign
4. The scope of variables:
local
global
static
parameter
Other local effects of 5, functions, etc. domain references a global variable, we need to declare a global
6, all variables are defined as a function of external global variables
 
Third, the global variable is referenced in function mode:
$x = 10;
mytest(){
global $ x;
echo $ x;
// or use GLOBALS [ 'var_name']
GLOBAL echo [ 'x'];
 
}
 

Guess you like

Origin www.cnblogs.com/h-gallop/p/11567075.html