5 ms·
The one thing I dislike about how a lot of php code is written is the way that requires are used as function calls (but without any declaration of what variable
by grandalf 16y ago
The one thing I dislike about how a lot of php code is written is the way that requires are used as function calls (but without any declaration of what variables the required code is expecting to find).
Oddly, Rails partials work this way too. They can see the controller's instance variables and are often written without any sort of defined interface, which makes for confusing, brittle code. Fortunately Rails offers the option to pass in :locals (just as php offers the option of simply using functions instead of require).
- jasonlotito 16y agoWait, what? A lot of PHP code use requires as functions? Honestly surprised here. I've never seen this.
- grandalf 16y agosugarcrm, phpbb, and others do it. It's very ugly. I have not seen either codebase in several years though so it may have changed.