2, database operation class (call configuration File) db.fun.php:
3, apply File test.php:
4, global keyword:
This script will not produce any output because the echo statement refers to a local version of the variable $a, and it is not assigned a value in this scope. PHP's global variables are a little different from C language. In C language, global variables automatically take effect in functions unless overridden by local variables. This may cause some problems, someone may change a global variable. Global variables in PHP must be declared global when used in functions.
The output of the above script will be "3". Global variables $a and $b are declared in the function, and all reference variables of any variable will point to the global variables. PHP has no limit on the maximum number of global variables that a function can declare. |