That’s what I’m wondering, these days.
I never actually learned PHP, I’m afraid to admit.
I’ve used it, once, in college. But that was like 10 years ago.
I watched Rasmus Lerdorf himself give a talk on 25 Years of PHP, and I feel like I learned a lot.
I always thought of it more like a weird templating system but it seems much more like a useful wrapper over some C functions. Not so much a language endeavor, with a giant interpreter, but like a C runtime with functions more immediately useful in a templating language.
Overall, I think the model it strikes / strives for is a really natural way to break down the problem. Where the problem is: give me a language to respond to document/resource requests and also be useful for shell scripts.
I’ve seen the recent gains in performance in PHP, and I’ve got to say it’s compelling. I thought Hack/HHVM was compelling, but they kind of un-necessitated its existence.
Maybe, long-term, they’re gonna rewrite it in Rust. And Apache, too.
After Rasmus’s talk, I watched I think Developing cacheable applications by Thijs Feryn from Varnish. I have certainly heard of varnish, of PHK fame. I was surprised how sophisticated you can get breaking down a response into
esi_include sections et cetera to cache stuff with a really fine touch. All while keeping the language interface simple, just normal PHP.
I mean they’re still solving problems in the PHP world, the same problems, they’re just not championing A Language, necessarily, to slay their dragons (they just do it in C? and the rest in PHP?)
I still like PHP a lot more than Python, and maybe even more than Ruby. I like Rails a lot, and I think it makes a ton of sense.
Closing the gap with Hack/HHVM is what really does it for me. I almost can’t believe how good its feature set is these days:
- some sort of static typing (not the best, but almost none are, except Rust/ML/Haskell)
- JIT soon? and performance already basically on par
- scripting language, useful on the CLI (fast! startup)
- server-side scripting language, obviously
- no transpilation step, though this usually means the language will suck in some way but static analysis is more straightforward
- namespaces, right? I like the
Also some nonsense I’m partial to
$variableswith dollar signs (no joke)
- C-like syntax, mostly (though I do like K & R braces, and it seems most do it the other way)
- pragmatic more than pure
- super simple deployment
I know a little bit about the Swoole / Workerman / ReactPHP stuff, and it seems simultaneously very different and interesting. It’s like node.js. Which means it’s not quite like PHP. It’s like writing node.js in PHP.
If you really want one thing to run on one port, it sounds great. ReactPHP looked useful for CLI stuff, for sure, from the video series I saw.
Anyhow, it’s definitely interesting. I don’t think it deserves the unloved reputation it’s got, especially versus the Big Boys like Java, Go, C#. To be fair, Spring is certainly useful, Spring Boot definitely useful, vert.x is great. I don’t know much about Go web frameworks but it’s like node.js with halfway better types and real coroutines, so how bad can it be? And C# is pretty nice with ASP.NET Core, it’s just all around pretty good.
But they all seem, from a certain perspective, to have the cart in front of the horse: they are first and foremost languages, with good web frameworks. PHP is more like DSL for web programming that happens to be useful for other stuff, like CLI scripts.
It’s not the worst, that’s all I can say right now. I’m still learning.