Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on PHP - Why using "global" considered bad?
Post
PHP - Why using "global" considered bad?
+2
−0
In PHP why is using global
like in the example below considered bad?
$a = 1;
class foo
{
public function bar()
{
global $a; // <-- Why is this considered bad?
}
}
I want a concrete example(s) of what can go wrong with this code.
1 comment thread