5 ms·
PHP deliberately has a low barrier to entry, and as a result there is a lot of poor quality code out there, written by beginners. People like to use this fact t
by osrec 5y ago
PHP deliberately has a low barrier to entry, and as a result there is a lot of poor quality code out there, written by beginners. People like to use this fact to suggest that the entire language is bad, which it most certainly is not.
I've seen lots great, well structured and performant PHP code - the quality depends on the programmer, as it does for any other language.
- tinus_hn 5y agoBack in the days it had terrible defaults that made it very difficult not to write insecure code and it was lacking so much it was really hard to write good, structured code.
- osrec 5y agoBack in the day perhaps, but not today. PHP has come a really long way.
- edoceo 5y agoIt's not the wand, it's the wizard.
- zdragnar 5y agoIf you recall the cartoon of programming languages as weapons, PHP was a sword without a hilt, which was quite fitting. Despite the low barrier to entry, there were "features" that were / are distinctly dangerous, and should not have been exposed to beginners (the comments section in the official documentation os a perfect example of this).
- 542458 5y agoAs somebody who loves PHP, some PHP mockery is deserved. The standard function naming and argument ordering is inconsistent and stupid. It throws errors written in Hebrew. There were fundamental decisions made that harmed web security for years. Unicode wasn’t in PHP for a long time. Getting decent performance and/or scaling was/is a major challenge. The comparison tables are questionable at best. Etc. The language is bad, but... you can still write great code in a bad language. And you don’t need a good language, or even good code to build a great website. Facebook has made more money with questionable PHP code than any site built with elegant pearl webscripts that I know of. Wikipedia is PHP. So was Digg (RIP). Your users don’t give a darn how good your language or code is so long as it usually works. So tl;dr, PHP sucks, but I love PHP.
- nkozyra 5y ago> Getting decent performance and/or scaling was/is a major challenge. The rest of what you say I agree with, but the language was never a performance bottleneck over other scripting languages. It certainly scaled better than ruby or perl or python apps with the same logic. The fact that each request was fundamentally stateless and ephemeral helped this if you needed to distribute your app and made development faster as well. Back to V5 it outperformed its competition in benchmarks
- cutler 5y agoParadoxically, PHP's stateless architecture is also what makes it dog-slow with large frameworks such as Laravel. Now you have to load the whole framework with every request.
- aetherspawn 5y agoSort of, but you don't need to parse it. Anyone using PHP in serious prod uses something like memcached/opcache to skip parsing, which speeds up TTFB typically by about 200x.
- fogihujy 5y agoEven a bog standard LAMP setup has opcache enabled nowadays.
- progforlyfe 5y ago> the whole framework Files are autoloaded lazily, meaning only classes that are touched are loaded on any given request. If the code is split into well sized, purposeful modules, it becomes a non issue.
- jeltz 5y agoIt outperformed them in benchmarks but not in practice due to having to reload all libraries on every request.
- 5y ago