3 ms·
What problems does PHP as a language solve better than other languages?
by skinner927 6y ago
What problems does PHP as a language solve better than other languages?
- poletopole 6y agoGood question. Mostly html templating since that is how it began. So you could argue improving that aspect would be a good idea. The major challenge for most is debugging because it is hard to separate the server from the PHP. I may toy around with Lua and see if that can be fixed.
- godot 6y agoI agree with you on PHP doing html templating well, however it just seems not big enough of a strength, if you will. I also had a decade of PHP experience before transitioning to nodejs in the last few years. I first transitioned for my day job, and then also started using node for hobby projects. For hobby projects I like to keep things as simple and quick as possible (translation: so no React frontend and all that stuff), so I was trying to emulate how PHP does things and just have my node server render html from the server. I've found that almost any way I try to do it, it's a little bit more awkward in node and you end up having to choose from one of the dozen of templating libraries and learn their syntax (no-go for me). In PHP one of my favorite things is, say you pick up a super simple routing lib like ToroPHP. In your route handlers you could skip all templating libraries altogether and simply require() a .php file that is your view html. It would simply be a file that contains HTML where you could sprinkle php statements anywhere. It's just about the the best/easiest way to template HTML output from the server for hobby projects (and I argue even for larger projects too in many cases). What I end up doing for hobby projects in node now is usually going JAM stack. Build my frontend in Svelte (which is as close to no framework as possible), and build API server in node with Fastify. I guess where I'm going with that is that a setup like that isn't much more hassles than doing PHP and html templating for these small projects.
- adventured 6y agoAs a package deal it does CRUD / CMS better than any other languages and always has. This is why prominent giant CRUD / CMS services used it, including Wordpress, Wikipedia, Tumblr and Facebook. And it's an even better language now than it was when those services started using it.