5 ms·
My Favorite Language Has Changed to PHP
- krageon 5y agoNo substantive argument made here, except "PHP has changed in the past 10 years".
- dolni 5y agoPrecisely. And even so, the things that PHP would need to change to make it acceptable would basically make it a brand new language.
- mountainriver 5y agoWhy would I ever be inclined to use PHP again? It’s only okay for web servers, but with a language like Go or Python I can do a lot more with them. PHP was an utter mess. Has it changed? I don’t care. It broke my trust and I’ve moved onto languages that are more thoughtful and general purpose. Returning to PHP would feel like returning to an abusive relationship
- Ourgon 5y agoThe Python 2.x to 3.x transition was also quite messy and long-winded but now 3.x rules the roost. Recent and coming PHP versions have done and will do away with much of the evolved mess that the language accrued in the decades. Performance is OK, deployment is easy, it is nearly universally supported, the build system is quite a bit more sane than the spaghetti-ball-like mess around node and friends. It is possible to use PHP for CLI apps as well but this is a bit of an afterthought: if (PHP_SAPI == "cli") { # CLI-code goes here exit(); } It is the right tool for a lot of jobs - not for all jobs but what language is?
- Axnyff 5y agoThe transition was awful but both Python 2 and Python 3 are good languages
- Ourgon 5y ago...which also have their problems, e.g. text encoding handling in Python 2.x was horrid and full of traps. This is better in 3.x, problem mostly solved. The same goes for many of the warts in PHP which have been fixed or are scheduled to be fixed in 8.1 and later. Given a choice between a world without PHP and one with it, warts and all, I choose the latter. Not because of its elegance or correctness or performance but because of its utility. In this respect it is a bit in the same situation as Bourne/Korn/Born_Again shell, languages which surely could be better in many ways but excel in just being there when you need them and for the purposes you need them. The language at hand is often the best language for the job, just like that phone camera in your pocket is the best camera to snap that shot of whatever event you just happened upon. Sure, it would have been better if you could use a DSLR on a stand, shooting raw to be processed in some fancy tool but that DSLR and stand and tool generally complicate matters far more than they add in quality. Sometimes this is worth it, often it is not.
- mikojan 5y agoFor one, PHP generally outperforms Python by a large factor. Also, to claim trust has been "broken" is just weird. Every software engineer should be well aware of the horrible mess that is the PHP language even if they had just had a cursory glance at it. In any case. I would never pick PHP on purpose either. Even if it was the most appropriate tool in a given situation. It simply makes my blood boil, and I don't care if it's irrational.
- marcosdumay 5y ago> Has it changed? Both development team and the community matured and learned a lot. The language lost a few of its footguns, but preserve a lot for compatibility reasons. The best practices evolved in good ways, but the old documentation is still around. So, yes it changed. If it changed enough is a different question.
- freedomben 5y ago> It broke my trust Can you elaborate on this a bit? What trust did you have in PHP, and what did it do to break that?
- jonnycomputer 5y agoThis passage broke my brain. >When I learned Assembly, I think I broke my brain, permanently. ...when I came back to C#, suddenly, I felt too constrained. Like, if he'd been talking about a functional programming language or Scheme or something like that I'd be nodding my head along.
- spacemanmatt 5y agoWhen you're this wrong about a topic, most people quit even trying to correct you.
- MD87 5y agoThere's a much more sensible C# merge sort implementation in the same repo as the oddly-over-the-top one linked in the article, which is very very close to the PHP one: https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorithms/Sorters/Comparison/MergeSorter.cs https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorit...
- hayd 5y agoYou can’t beat that kind of productivity.
- zihotki 5y agoHow do you measure productivity and how can you prove that productivity in PHP is higher than in C#? In my career language was never a productivity bottleneck. Good quality frameworks and libraries do make a big difference on the other hand.
- WalterGR 5y agoThat’s an excellent question, but they were just quoting the article.
- zihotki 5y agoIf we strip whitespaces in the merge sort version you provided and apply same formatting it becomes a 30-liner https://pastebin.com/KmWBMC0M https://pastebin.com/KmWBMC0M vs 31 lines of PHP.
- kennu 5y agoThe best feature of PHP has always been that it's "serverless", or in more historical terms, stateless. The application itself doesn't have to worry about keeping a server running or making sure it doesn't leak memory or crash. Blast radius is limited to a single HTTP request, just like in AWS Lambda. The downside is that the PHP service environment does't provide much of a runtime framework, so the PHP application itself needs to perform a huge amount of bootstrapping on every request (this builds up over time as you add stuff to the application). Comparing this to AWS Lambda with e.g. Node.js, Lambda can keep a lot of stuff pre-initialized in memory, and usually just directly execute a handler function. Also things like URL request mapping are externalized to a separate API Gateway. There used to be a lot of tweaking and running separate caching modules needed to make PHP bootstrap fast enough. I've always been sad that AWS hasn't developed a fully supported PHP backend for Lambda. Combined with a lightweight HTTP gateway, it could be a nice way to keep running legacy apps like WordPress in modern serverless environments, without worrying about server costs and maintenance. You can do it yourself with Lambda layers, but there will be all kinds of small mystery timeouts and problems you have to deal with.
- marcosdumay 5y agoWhen I read comments like this I always wonder who is out there creating stateful HTTP applications? How does one manage that? How does it not break on every infrastructure change? In any way, I have never met those people.
- kennu 5y agoAt least I wrote a lot of Ruby on Rails and Django (Python) applications back in the day. They always run their own server. I.e. there is no isolation between the server and between the application code.
- marcosdumay 5y agoAnd PHP runs in Apache (or whatever else you use). And an Amazon Lambda runs on their web server.
- MaxMoney 5y ago
- throw_m239339 5y agoI wish I could downvote links on HN. I wouldn't flag that, because it isn't something outrageous, it's just a bad post that doesn't even try to substantiate its point in any meaningful way.
- wccrawford 5y agoI'm a daily PHP programmer and I'd pick it any time for server stuff... But wow, this is not a convincing article at all. It's just an opinion with nothing to back it. If this was on a forum, I'd think it was a waste of space and ignore it. But a blog post? And someone shared it here? What were they thinking? Edit: I see the author shared it here. Wow.
- thehappypm 5y agoThe most interesting thing for me was the end where the author identified a few huge pain points of PHP!
- withinboredom 5y agolol, this got way more attention than I expected. > But a blog post? And someone shared it here? What were they thinking? I honestly wasn't expecting anyone to care about my opinions but shared it here on the off-chance there would be an interesting discussion about PHP/C#. Though, it mostly just to seems to be people complaining about my opinions, so maybe that was a bad idea.
- midrus 5y agoHonestly, I can't care less about "languages". To me they're just syntax. And for all the kind of web applications I've built, the performance has never been a big concern over other stuff such as building features, fixing bugs, development speed, etc. What does matter A LOT for me is the ecosystem, the tools, the editor support, the libraries, the frameworks, the community, etc. And PHP does GREAT at this. I'm using Laravel nowadays and it feels like a better Rails, with better tooling, better editor integration, more people using it, more community, more libraries, etc. Is the language a bit uglier? yes, but I don't care about the syntax, everything else matters a lot more to me.
- CarlGroovy 5y agoCall me an elitist, but I'm a big fan of well thought out languages built from the ground up by smart people like Java and C#. PHP is more of a hodgepodge of functionality glued together. However, I can appreciate PHP's simple way of getting server-side processing up and running.
- spacemanmatt 5y agoI won't call you an elitist for preferring tools that are cohesive. PHP has lost its chance to be a cohesive language. That ship has sailed.
- freedomben 5y agoNeat, I did not know you could use Nginx Ingress directly with FastCGI! That was worth the read alone. I've certainly warmed up to PHP over the last couple of years as I've been maintaining a couple apps, and while it's nowhere near my favorite language, I do think PHP gets an unfair bad rap because of historical terribleness.
- spacemanmatt 5y agoI'm still not in love with the language but if I have to go back...ever... https://github.com/ReactiveX/RxPHP https://github.com/ReactiveX/RxPHP