The scope of a variable is the context in which it is defined (that is, the scope in which it takes effect). Most PHP variables have only a single scope. This single scope span also includes files introduced by include and require.
For example:
The code is as follows | Copy code | ||||||||
include 'b.inc';?>
|
The code is as follows | Copy code | ||||||||
$a = 1; /* global scope */
} Test(); ?>
First, an example of using global: Example #1 Using global
Related labels:
source:php.cn
Previous article:Implementing asynchronous calling of multi-threaded program code in PHP_PHP tutorial
Next article:Introduction to various methods of generating html files in php_PHP tutorial
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|