Background
Today I'm familiar with the basic syntax structure of PHP, including variables, types, constants, operators, strings, scopes, and functions, and this article lists some of the structures I need to strengthen memory (unlike C #).
Some of the individual structures
foreach structure
1
1, "B" =>2); 3 4 foreach ($array as $value) {5 echo "Value$value
"; 6} 7 8 foreach ($array as $key = + $value) {9 echo "$key + $value
"; Ten}11?>
1 value12 value23 a=>14 b=>2
Global and Static scopes
Variables declared outside the function are global scopes, and the $global within the function $var equivalent to $var = $Globals ["var"]. Variables in the static scope are initialized when the function is first called, the function is not cleaned up, and subsequent function calls are no longer initialized.
1
";}13 scope_test (); Scope_test ();?>
1//output Content 2 1, 13 2, 2
Variables of variable
1
"; 6 echo $Tom."
"; 7?>
1 I am tom2 I am Tom
Constant definition
1
"; 5?>
1//Output Content 2 3 happiness
String insertion
1
"; 6?>
1 I am tom,i am tom,i am Tom
Heredoc
1
1//Output Content 2 3 De Guangwei
Scope of the function level
1
1//Output Content 2 3 11
function returns multiple results
1
1//Input Content 2 3 (1, 2)
Note
There is one more question I do not understand, I have to check the information tomorrow, the question is: How is the memory of PHP allocated and managed?