I’m wondering why all frameworks pass data to Views by an array, usually called $data and extract its contents when rendering.
Is there a real benefit for that or they’re just a bunch of intelligent fools?
Note: Preventing the company designer from hacking isn’t a good reason!
The reason is you’d risk polluting the global namespace, overwriting previously-declared variables with unexpected values and causing all kinds of trouble. It also makes it much less clear where the values came from, the upshot of which is the source becomes less easy to follow, less easy to understand, and more importantly less easy to maintain and update.