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.
Post History
Nothing in particular will go wrong. global is a valid and supported keyword, the code will work. There is no problem for the computer. The problem is for you. When something is global, it could b...
Answer
#1: Initial revision
Nothing in particular will go wrong. `global` is a valid and supported keyword, the code will work. There is no problem for the computer. The problem is for you. When something is `global`, it could be getting changed by anything else. You have to read through the whole codebase, to understand what exactly it's used for. If it's local, then it cannot be changed by things outside the local scope, which makes it a lot easier for a human brain to keep track of things. This is the main thing wrong with `global` and it's not specific to PHP.