|
|
|
|
|
by dgb23
743 days ago
|
|
If you use the std lib you can write a simple web app in Go as well in few lines of code? The only difference would be a little bit of boilerplate for setting up application state (a few lines) and the necessary type definitions, which you can avoid with PHP if you just deal in "arrays" instead of classes. But I don't think the LOC would explode for Go. My big counterpoint is this however: I would wager for a beginner of either languages, it's much more straight forward to get a server running with Go than with PHP/Apache. There's no configuration, you don't need to install multiple things, you don't need to learn about a thousand footguns, error handling is more streamlined and obvious and you wouldn't have version issues and get showered in deprecation warnings down the line. And even though the PHP docs are quite extensive and useful, they are not on the same level as authoritative Go docs and guides. PHP has three advantages over Go in terms of convenience and ease of use: statelessness, little bit easier to deploy (once set up) and very cheap, easy to use hosting products available. |
|
PHP is made for web development though, while Go is made for different use cases. Comparing the standard libraries makes this very clear.
Things PHP comes with that Go doesn't come with (just as some examples about standard library differences): PDO (DB interface), session management, built-in mail sending, localization and internationalization. That's just from the top of my head.
Go has it's places though, and it works well for web development too. But even I who like Go in general more than PHP, can acknowledge that PHP (by default) is better setup for web development out of the box.
That said, I would much prefer Go than PHP too, but hard to argue against PHP for web development without resolving to emotions and feelings.