Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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).



Wait, what? A lot of PHP code use requires as functions? Honestly surprised here. I've never seen this.


sugarcrm, phpbb, and others do it. It's very ugly. I have not seen either codebase in several years though so it may have changed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: