在C/C++中,全局变量和我的教授认为的一样糟糕吗?
c c++ global-variables
function foo () { global $var; // rest of code }
在我的小PHP项目中,我通常采用程序方式.我通常有一个包含系统配置的变量,当我需要在函数中访问此变量时,我会这样做global $var;.
global $var;
这是不好的做法吗?
php global global-variables
global-variables ×2
c ×1
c++ ×1
global ×1
php ×1