Hacker News new | ask | show | jobs
by untog 3772 days ago
I agree, but if someone were starting a new project I'm not sure why I'd recommend PHP over any other stack.
2 comments

Things I like about PHP: it's not perl, which it replaced for webdev. It's very optimized, and people with fat budgets pay for that (eg. Facebook). It connects to everything. Most of its (useful to webdev type situation) libraries are more mature than the equivalents in other languages, because more people have used them for longer. It had working unicode from the early days. It runs everywhere. Loads of people know enough of it to be dangerous / collaborate, and they tend to be numerous in the young/cheap hire pool. It's pretty much web-oriented, but can do scripting fine as well. It has a relatively stable configuration. Honestly, I think it's a very Unix-like solution to webdev problems, because it lets you roll your own solution, stays out of your way (unless requested), and encourages you to code in higher level languages. Yes, a lot of the code out there is horrible. Yes, most people code on frameworks which replace half the language with ugly hanging half-implemented abstractions. Yes, the function name thing is a pain. But mostly, really always almost mostly, it just works ... quite fast indeed, and everywhere. Yay PHP!
Ooh, please don't badmouth perl. Modern perl (e.g. https://pragprog.com/book/swperl/modern-perl-fourth-edition ) is a much more sanely designed environment than modern php is.
I originally wrote a long comment about how I've written CPAN modules and worked professionally in perl but will never do it again, explaining why technical betamax superiority was irrelevant because perl's users left before it got its act together, but I think in hindsight a simpler summary would be this: grep 'man perldsc' ~/.bash_history|wc -l
each to their own. I'd like to do more stuff in other languages, but my perl skills are in too high demand, and it's fun.
Works, gets constantly better, no JS-like fatigue, fast PHP7 engine, tons of tools, libs and support.
Isn't all of that true of, say, Ruby?
I am pretty fluent in ruby, which I learned after PHP specifically because I wanted to migrate, and I really enjoy using it. However, compared to PHP ruby is slow, it took ages before it had a half-decent unicode solution, and once you step out of the rails rah-rah it's a bit desolate on quality libraries... there's 10 half-built versions of everything, and no decent go-to implementation. On the plus side, ruby is nominally better for reflective metaprogramming, but that's really a rare use case.
The "fast PHP7 engine" part not. Raw Ruby was slower (but comparable) to raw PHP, so with this new engine which consistently runs real life workloads 2x, PHP7 should be like twice as fast.

And PHP still has more vendors, support in all kinds of hosts, even in third world facilities, and more companies offering commercial support. Plus there's stuff in PHP that don't exist with the same level of maturity/adoption/community in Ruby/Rails, e.g. Wordpress.

And even a path to static typing, through Hack.

It may be, but the above poster also left out one of PHP's strengths - availability. It's already running and ready to go on whatever cheap shared host you've been on for the last 20yrs. Ruby/Rails likely isn't.