PHP vs Nodejs vs Go
- 23 Oct 2019
I have even seen several replies asking people to learn both and then decide - doesn't this defeat the purpose of the question to begin with ?
Indeed there is some wisdom in gaining proficiency in several languages but sometimes you just want to know which is better for web development -- or at least what is better according to other people that had experiences with both.
So here it is, my non-professional opinionated review of the differences:
My experience from PHP is somehow dated. I started using when PHP was the web programming language to be used.
Most of web-code before PHP was the infamous /cgi-bin (internal server error anyone?) perl. In my experience PHP has the best learning curve vs Node or Go and you can pick up things very quickly. Everything you need for the web is available as a standard function: database connections, post/get variables, json handling and much more. You don't need a template engine because PHP *is* a template engine. So there is nothing really wrong with PHP. I hear that PHP7 had also some great speed improvements. In terms of speed I did benchmark it with Node and Go and there is really no major speed difference for a small or mid-size app (yes what most of the people will be writing anyway). There is nothing to dislike about PHP but code quality will vary greatly. You have complete freedom on how to do things and freedom can become confusion. I am not a huge fan of PHP frameworks so I can't really talk much about them.
In summary "use the best tool for the job!" (just kidding) I would say that for small web apps the best choices are probably PHP or Node.js with a good framework like express. I would also think that Go is an excellent choice if you like (and can pick up) the syntax. In fairness I have seen go tutorials and courses mostly discussing about using go for APIs. I think this is what Google invented for but I did use it for pure web apps with very encouraging results.