5 ms·
My feelings about PHP are stuck in what I remember from 2004. If I’m starting a new backend web project in 2019, should I be considering PHP over Ruby, Python,
by sickcodebruh 8y ago
My feelings about PHP are stuck in what I remember from 2004. If I’m starting a new backend web project in 2019, should I be considering PHP over Ruby, Python, or TypeScript? Why or why not? I’m curious to hear from anyone who’s used it professionally in the last couple years.
- drubenstein 8y agoI've had a reasonably good time with Laravel (versions 5.x), although not having a lot of experience with other stacks (say, django), ymmv. That said, I don't think it's so profoundly amazing as to be worth learning PHP if 1) you're not already somewhat exposed to it or 2) the place where you work doesn't already use a lot of PHP.
- legohead 8y agodo you care about performance? PHP, Go, C# you'll "figure it out later"? anything else that floats your boat
- godot 8y agoFor majority of backend web project, in 2019, there should be nearly no technical advantage re: one language over another among all the popular ones. (i.e. the ones you listed: PHP, Ruby, Python. I would argue to use pure nodejs over Typescript though. Most people underestimate the dev flow speed it gives you to not to have a compile/transpile step. Refresh and rerun is part of what made PHP so popular years ago.) In short, use whatever you're comfortable with. If you're super proficient with PHP, keep using it. If Python is that language for you, use Python.
- h1d 8y ago> Refresh and rerun I don't understand how this isn't easy on other platforms. This is such a huge advantage of PHP that somehow isn't easy to do elsewhere. I am using pm2 to restart ts-node on file change to get around it but it does take a second or 2 or else I get hit with 502 Bad Gateway on browser reload which is sometimes annoying. rails also does it automatically but this is not instant and sometimes shows me an old version, so I restart the rails instance manaually in case when I want to make sure which is a sad additional step that no PHP dev ever does.
- reallydude 8y ago> there should be nearly no technical advantage In practice there is. Specifically in regard to parallelism and performance, which is important for any non-trivial application. You can spin up multiple Python processes or just re-implement in a different language, some nuanced part of the stack that you've crafted to bottleneck(s), or you can just choose not to use it from the start. It's not like you're going to design around the deficiency at all levels. You'll run into Ruby performance problems very early on without specific knowledge, so people just stopped using it for anything load bearing. My bias against Ruby is limited to PoC programs having memory problems and poor performance compared to virtually identical implementations in other languages, being a cultprit. YMMV. Perl is hard for people to understand, since every feature of the language is a landmine of obfuscation...php is getting there on it's own, to be fair. The idea that there should be no technical advantage is ignorant. There are choices that have been made and there's reasons for each. You don't run Python on stream processing with Flink because it's not suited for parallelism. Catching errors like a kafka broker disappearing, in PHP, is almost trivial like in many languages, while Java requires a custom retry method that requires intimate knowledge of how any connector works. Knowing the languages, PHP has some very compelling strengths, as does Java (performance and safety) and Python (generally consistency of implementation and speed of development)...I still don't understand why I keep running into rats' nests of javascript and other esoterics.
- sickcodebruh 8y agoI find that the cost of TypeScript's compiler more than pays for itself with all the other benefits it offers. It's to the point that I can't imagine working in JavaScript without it and I'm less happy working in other dynamic languages when I'm forced to. Refresh and rerun is great when you're developing but offers you nothing when you come back to the code weeks or months later. A good type system has your back even after you've forgotten how everything fits together.
- ognarb 8y agoI use Symfony 4 and like it. Clear config organisation, class based controller with logic and route embedded together. Twig the templating engine is nice and doctrine is a very powerful ORM.
- lugg 8y agoI still use PHP a lot. PHP's problems are largely user driven. What drove you away in 2004 is likely still there. The community is still full of people who have no idea. Laravel is still king. Noun driven OO is still perceived as a good idea. But on the flip side, the language has some nice features now and performance got a big boost too. Still a couple of things missing but it's getting there.
- kibibu 8y agoComposer is new since 2004, which is pretty great
- h1d 8y agoNot too serious but I want to stop using a language still forcing me to type semi colons. CSS -> Stylus. I don't even have to type brackets and colons and not just semi colons. JS -> JS (TS). Some people may not be aware but you can fully write JS by omitting semi colons. (Except on a few occasions* but I can write a project without one just fine and decent editor will warn you when you're supposed to have one, like IntelliJ and derivatives. Configure it to not prefer semi colons and 1 shortcut key to reformat the code and all stripped.) PHP -> Ruby, Python, JS all don't ask you for semi colons. Array expression is also too verbose in PHP. Java -> Kotlin. HTML -> Pug/Slim/Etc. While there's no semi colon, the verbosity of HTML is insane, people will appreciate the simplicity of template engines like Pug and never look back. Bash -> Bash. They didn't have one decades ago... * https://flaviocopes.com/javascript-automatic-semicolon-insertion/ https://flaviocopes.com/javascript-automatic-semicolon-inser... (some random blog explaining JS semi colons)
- lugg 8y agoI'm a big fan of standardjs. Beats prettier and the rest. Takes more of a go fmt approach. While debating myself on whether to learn rust or go next I fell into clojure. I'll probably pick go up next and then rust.
- stephenr 8y ago> I want to stop using a language still forcing me to type semi colons. Fuck it, go one step further and stop using languages that expect you to use any formal syntax. Just write down "Computer do this thing! Now, good and bigly like!" and then wait for it to happen. Of all the fucking complaints about a language "requires semicolons" is the most ridiculous thing I've heard (and no you're not the first place I've heard it, but it's still as ridiculous now as it was the first time I heard it). > Ruby, Python, JS all don't ask you for semi colons. Except, JS does require semicolons, it just happens to be able to insert them for you in some situations. > Array expression is also too verbose in PHP Array syntax in PHP is the same as in JS: `['foo', 'bar', 'bar'];`. Oh that nasty semicolon is the "verbose" part I bet?
- h1d 8y agoIf your team only knows PHP, it's just a small project or you only have the resource to find PHP dev replacement, just use it. Easy to use, online resource is plenty, you won't get stuck unless you want to do a lot of parallel task. Just scraping web efficiently in parallel is kind of a work to get it done in PHP. Right now I just love having type definitions through TypeScript that you can never have in PHP. (Every variable and hash members starts to have a meaning, which means no mistyping of names, never specify non existing member or method and never use wrong method, as in you can't use numeric methods on string members which happens far too often in other languages and the return value is completely consistent. Say, you have a switch statement, and all of them returns a number but you forgot to add 'default' and TS complains that the method is not always returning a number.) Ruby as a language is beautiful although it doesn't have the power of TypeScript, the code looks far more beautiful than PHP and if you like how rails works which pushes their rules down to your throat but if you feel it tasty, you might like it too.
- tylerjwilk00 8y agoPHP is faster than both Ruby [1] and Python [2] and unlike TypeScript the executed code is the same as the written code, no transpiling. [1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/php-yarv.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... [2] https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/php.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- gravypod 8y agoLike the author of the article said, most websites are I/O bound tasks. This is a CPU bound benchmark.
- igouy 8y agoLike the author of the article also said: "To improve the ability to execute math faster in PHP seems, at a glance, to be a very narrow scope. However, this in fact opens the door on things such as machine learning, 3d rendering, 2d (gui) rendering, and data analysis, to name just a few."