java软件工程师学php -12.变量作用域

WBOY
Release: 2016-06-13 13:11:27
Original
838 people have browsed it

java程序员学php -12.变量作用域
1.php比java多出了一个“文件”作用域(正式名称叫“全局作用域“,在当前php文件里有效),即写在php文件里但独立于任何函数之外的变量的作用域. 这跟javascript里定义的全局变量有点像,但在php里,函数内部无法访问此类变量。

2.通过require包含进来的文件中的变量的作用域是什么样的? 如果你在函数里调用require(),则被包含的文件中的变量的作用域为当前函数; 否则为全局作用域

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template