10 ms·
I used to work way back in the day on PHP too, but even though I'm sure this will be downvoted, it's really sad people still take it seriously as a language in
by zeptonix 4y ago
I used to work way back in the day on PHP too, but even though I'm sure this will be downvoted, it's really sad people still take it seriously as a language in 2023. There's nothing remotely elegant about it. It's not expressive or programmatically succinct in the way Ruby is. It's not beautifully well thought-out the way Python is. It's not fast and modern in the way Rust is. It's not elegant or composable or client-side renderable in the way React.*script is. It just brings nothing to the table. It's an ugly hodgepodge borne out of an over-engineered homepage from 28 years ago. Various business interests have kept it afloat, and people who don't know any better keep championing it. I think people do eventually catch up with what's going on though as soon as they personally experience writing anything remotely serious (5-10,000+ LOC) that isn't a simplistic web-app.
- mariusor 4y agoSorry to be dismissive, but elegance, expressiveness or succinctness are not mandatory for "making things". Gatekeeping a programming language on esthetics is quite shallow in my opinion. Ease of use and deployment, breadth, availability, low cost of maintaining, are sometimes more important, and PHP offers plenty of value in these respects. I don't want to work with it, but I will never presume to look down on people that do. PHP has been a cornerstone for a whole generation of programmers and I think the current web-development ecosystem would not be where it is without it.
- zeptonix 4y agoYeah I do agree it was a stepping-stone in many ways.
- nattaylor 4y agoI might be misinterpreting "taken seriously" with utility, but to me it is very valuable that a PHP script can just be dropped on almost any web server and it can start doing stuff, and that alone is reason enough not to not dismiss it.
- zeptonix 4y agoKinda, you have to make sure all the extensions you need are installed, then fix php.ini so it's not doing anything wrong, and then it usually works if you haven't missed anything, until something becomes deprecated.
- NerdiOrg 4y agoI used to agree with this and think of it as a main benefit, but setting up a server to use Nodejs is easy and a lot of servers come prepped with node, npm, etc, so it's just as easy ad starting up a PHP project, if not easier because package.json can easily install dependencies.
- archerx 4y agoI’ve made a few “serious” projects with PHP and has been great, I never feel like I’m fighting against it to do what I need to do, the code can be very concise, its very fast and has a lot of batteries builtin. Python is not beautifully well thought out, the syntax is awful and the version conflicts make it a mess. You’re comparing to React which is not a language or in the same domain is confusing and makes me doubt your credibility.
- koonsolo 4y ago> Your comparing to React which is not a language or in the same domain is confusing and makes me doubt your credibility. They both render HTML and do it in a very different way.
- NerdiOrg 4y agoYes, but that doesn't make it a programming language. A lot of things can render HTML. I am pretty fluent in Javascript, HTML, CSS, jQuery, React, Nodejs, Nextjs, PHP, Python, and a beginner in Java and a few others. React is not a programming language.
- zeptonix 4y agoRight, that's why it was React.*script. Regex.
- dubcanada 4y agoThat's such a strange statement, you can compare PHP and React because they both can return a HTML string? Even though one is built entirely within another language, and it isn't is not a "language". More of a toolkit. Same as say Symfony html framework is.
- archerx 4y agoThis is why I stopped posting on the internet people will twist and turn stuff for reasons beyond me. It’s like pulling teeth.
- deweller 4y ago> and people who don't know any better keep championing it Experienced developers understand that there are different tools for different jobs. They also understand that languages are not successful for 30 years without providing some legitimate value.
- whitepaint 4y agoSomeone who worked with Python / Django and JAVA / Spring for years professionally, I see PHP / Laravel as absolute superior way to build web apps, especially if you are in a team and people might come and go.
- Shish2k 4y agoI agree with all of those points, except that it does have one thing going for it - it is easy for end-users to deploy PHP apps: FTP your files onto any random cheapo shared web-host, done. I’m amazed that it’s been so long and no other language comes close to that :(
- viraptor 4y agoRe-deploy, sure. Deploy? PHP packages still need installing, modules need enabling/configuring, PHP version needs to be chosen, etc. Unless it's a tiny project, the days of "just put the files on FTP" are almost gone. Meanwhile for small, low traffic projects, serverless services are pretty close to the "just copy to deploy" model. And fly.io is all trivial for quite a few frameworks.
- GeneralTspoon 4y ago> I used to work way back in the day on PHP too, This is your issue - PHP < 5.3 is very different to PHP 7+. Not just at the language level - but the community, frameworks and best practices too. No more random scattering of SQL statements in HTML files! Modern PHP (with a framework like Laravel or Symfony) is probably one of the most productive ways to build web applications. > It's not beautifully well thought-out the way Python is. This is definitely an interesting take... Python hasn't even solved package management yet. And the 2.7 => 3 migration is probably the most famous example of making a mess of an ecosystem with backwards incompatible changes. In contrast PHP has Composer and 5.3 code is pretty much compatible with 8.0 (although ideally all code from the 5.3 era should be burned at the stake). > and people who don't know any better keep championing it. I think people do eventually catch up with what's going on though as soon as they personally experience writing anything remotely serious (5-10,000+ LOC) that isn't a simplistic web-app. You've basically just said that PHP devs are too inexperienced to be able to scale a codebase past 10k LOC? Pretty much every serious web dev using Symfony/Laravel would disagree with you.
- deleted 4y ago[deleted]
- makeitdouble 4y agoI'm on PHP 8 and I feel the same as parent. Sure, there's been a lot of progress since the PHP 5 days, but the core of the language has been left mostly untouched by design, and we haven't seen the kind of drastic moves like JS moving to ES6 syntax. It's a matter of taste, so there's no absolutr truth. I hate PHP's function and property access syntax differenciation and wildly prefer ruby's approach or instance. And there's so much more nice things coming in languages that have been designed from the ground up to be nice to use. I understand PHP's pragmatism, but can't find it pleasant to use TBH. PS: we got arrow functions, but they stay limited to anonymous functions for instance...
- afiori 4y agoThe one feature on PHP that I wish was more commonplace is the `use` keyword in function expressions as it is one of the few ways to limit what names are in scope at a given point in the code IIRC Rust's `mod` declarations can behave similarly.
- shashashasha___ 4y agowe should show this comment to facebook that uses hack (php originated lang) in millions of files to run their little website and infrastructure. php isn't bad. just got a bad rep. many langs got quirks. some more than others. but php has more web production success story and usage than most.
- jsjohnst 4y agoPHP had design flaws (many of which have been addressed since the 5.x days), but what language doesn’t? A significant cause of it’s bad rap is touched on briefly in this article, Wordpress. Even back in 5.3 days, you could write elegant and scaleable code, it just took work to do. At a former employer using PHP 5.3 on 2005 era hardware, we could do 500+ req/sec per machine with an average response time under 100ms and a P99 response time of under 250ms, with a zero downtime SLA and hundreds of millions of requests per day. Yeah, it wasn’t easy, but it worked. As a dear friend used to say, PHP is a ball of nails. You throw it and it sticks. Just exercise care when picking it up and all is well.
- oblio 4y ago> we should show this comment to facebook that uses hack (php originated lang) in millions of files to run their little website and infrastructure. Appeal to authority isn't a valid strategy. Facebook used PHP because they wanted to build something really quickly and afterwards it became too costly to switch, as it always does, so they built an entire engineering department to work around PHP issues. Your average PHP dev team can't do that. Plus, what are you comparing it to? Reasonable people don't compare it to Vlang, they compare it to Python, Ruby, Java, C#/.NET, Javascript/Typescript, Golang, and PHP ranks at best averagely against those regarding language, standard library and ecosystem consistency.
- shashashasha___ 4y agoappealing to authority? lol. no. read my comment again. it shows real production example of a juge, complex, website that serves billions. average php devs can't do that? maybe. but the php lang doesn't block them.
- dubcanada 4y agoIt doesn't matter what happens, anytime something good PHP is mentioned the thread always turns into a fight. Why can't we just stop gate keeping programming languages and let people enjoy them. PHP gets tore apart all year long, and 1 nice article comes out and everyone jumps on it like it's preaching Delphi or VBA. PHP has continued to done wonders for me, I continue to write huge apps in it, I continue to love it. I've used every other language you wrote, and continue to this day to write in PHP. Not because I'm not able to grasp how good another language is. But because it works. If I need something I go to packagist and search, it's always there. If I need to deploy something, there is tons of ways, and even basic ones. I don't need no fancy deployment setup, but I can have a fancy deployment setup if I want. But people are more then welcome to hate it, and every time a positive post comes out about PHP I will continue to post my statement and then carry on building stuff. As there is ALWAYS a negative comment.
- zeptonix 4y agoEveryone's at a different step in their journey. But I do agree if you're building stuff then exactly, who cares? End of the day it's definitely about what's built, not how.
- dubcanada 4y agoHN does a lot of stuff well, but there is a ton of gate keeping here and PHP is one part of it. It does not deserve the hate it gets, it's popular to hate PHP here. It's actually less popular to like PHP. So articles like the above always get torn up. It's rather sad to see, we should be encouraging people to build however they want. Point students in the direction of best practices and discuss ways to improve. Rather than talk about how much we hate the fact that PHP continues to be in the top 10 and pretty much the entire web is built with it. But people do love to hate.
- GeneralTspoon 4y ago> Everyone's at a different step in their journey. Text book example of being condescending.
- commitpizza 4y agoCompared to moat languages, if you have no visitors, php takes up 0 system resources from your system to just sit there and wait. So you could have hundreds of small sites on the same machine for an extremely low resource cost. That is something it brings to the table and its very beneficial for hosting solutions where there are a lot of small webaites sharing on the same resource.
- jimmaswell 4y agoAlong this line, I like how memory leaks just can't be a thing because the page only exists so long as it's being rendered.
- acomjean 4y agoThe language is valuable and a good choice because it’s easy to read and your codebase Be(when used with a framework) are very maintainable. We have Java Perl and python and php has been the easiest to get people working on existing code. The documentation is also excellent.
- xigoi 4y ago$For $me, $all $the $dollar $signs $make $the $code $hard $to $read.
- spoiler 4y agoI think that PHP isn't that bad for some use cases. What I really disliked about PHP as a developer was how much control the host has over tweaking the runtime; this can be"problematic" in some shared hosting setups. However, I'm also a bit of a hypocrite here because I worked for a hosting company, and also loved that feature. So, I think in the context of something like a container (or vps/dedicated) it can work well. I think PHP gets a lot of hate because it used to be a nightmare. I know friends who still use it, and they claim it's a day and night experience from the olden days. It probably wouldn't be my first choice for a project, but I probably wouldn't groan either, if I had to reach for it now
- codegeek 4y agoI was waiting for a comment like this. If I had a penny for.... I would be a gazillinaire :)
- Mikushi 4y ago> It's not beautifully well thought-out the way Python is Slagging PHP and then saying this just means you are trolling which is not exactly welcomed on HN.
- jensensbutton 4y agoIt's more productive as Ruby and Python and much faster than either? Is that not reason enough for some to choose it? I'd argue that of the PHP, Python, and Ruby it is Ruby that should die. It's the same use case as Python, but harder to read and just as slow.
- jimmaswell 4y agoI loved the straightforwardness of just having a nice simple HTML page with some <?PHP ?> sprinkled in. Now everything has to be done through a million layers of indirection. Which is fine when it's necessary, but I still like to write my own pages as simple unstructured PHP.