8 ms·
The worst part about PHP is constantly hearing from its detractors, who are often people who haven’t used the language in many years. Haystack needle order, $,
by user3939382 4y ago
The worst part about PHP is constantly hearing from its detractors, who are often people who haven’t used the language in many years. Haystack needle order, $, fractal of bad design, it just gets old.
The language isn’t perfect but I love working with it, these 8.1 and 8.2 improvements have really made it sweet.
My biggest gripe at the moment is the (very old) behavior of e.g. preg_match() and sort(). You’ve got a small handful of these common functions that operate on their input by reference/in place which is gross. A new version of these would be welcome.
- cies 4y ago> I love working with it Great! Keep using it! Ignore us. We (detractors) also had to use it and have since learned (hopefully several) other languages that (not looking at you JS) we like much better... :)
- zmxz 4y agoWhat was the motive behind this post? What do you hope to gain? If it's recognition for learning <insert-language>, how do I provide it to you?
- sdiacom 4y agoSomething that is extremely common in the PHP community, and pretty much absent in any other programming community, is this knee-jerk aversion to the idea of learning another language, and this sort of derision to those who do. Have you consider that people who learn other programming languages are not doing so in order to claim that they're better than PHP programmers, but for their own intrinsic reasons? It's such a weird, fragile ego situation. Does everyone else have to pretend that PHP is the only language that exists in order to placate your sense of inferiority?
- zmxz 4y agoLet's recap: post about PHP, ex-PHP user posts completely false info. Your reaction: "why do PHP devs get upset when ex-PHP users write false things about the language? Also, none of you know any other languages". Thanks for the ad-hominem, that concludes this discussion. Also, plenty of people who use PHP know so many other languages. You don't appear to be a professional in this industry, especially not with this kind of discourse. Take care.
- sdiacom 4y agoTo be clear, I never said that PHP developers don't know any other languages, and I don't believe that is true. My comment was in response to you asking whether the other user (who as far as I can tell was not posting any false information about PHP, just pointing out that they personally preferred other languages?) wanted _recognition_, from you personally, for having learned some other language. This is such a weird reaction to have to the idea that someone has learned, and/or would rather use, some other language. I hope you can see that. Of course, it's not just you. I have never seen any programming language community that feels _threatened_ by the idea of other languages existing and being learned, in the way that the PHP community does. Fundamentally, this is a learned social behaviour, which means that whether or not individual PHP developers know other languages does not matter. A community that treats acquiring additional knowledge as a _threat_, seeing learning from the outside world as a _betrayal_, will not be able to learn _from_ other languages. As bringing new ideas and thoughts into the community is socially discouraged, it will only be possible for learning to flow in one direction: away from the PHP community.
- zmxz 4y ago> who as far as I can tell was not posting any false information about PHP I asked what prompted the person to type that kind of reply. Had you read the entire topic, you'd see plenty of false info being posted, but my point remains: you used PHP, you moved on, what prompts you to be active in topic about PHP where all you contribute with is "I moved on." > This is such a weird reaction to have to the idea that someone has learned, and/or would rather use, some other language. I hope you can see that. And we're in territory of mental gymnastics now :) You think the reaction is to learning another language? You're obviously a programmer. Can you tell me how many possible outcomes exist and how come you chose this one in particular? Reaction was not to learning another language, it's ridiculous. > I have never seen any programming language community that feels _threatened_ You never read linux mailing list and c vs c++? I can't take you seriously, you talk as if there exists de-facto "community". There isn't one, it's just a bunch of people who use various forums and there's no coherent community. You interacted with several people and you label that community and then you purposely shove words that haven't been written only to challenge them. It's a straw man argument. You persist in labeling PHP devs so narrow-minded that they chase away people who learn other languages. I don't know which (human) language I need to use, but it's apparent that this is becoming multiplayer monologue. I write one thing, you claim I wrote something else and then you generalize based on it. Notice: I haven't tried to provide my "credentials" by listing what languages I know or what I do. I never even stated I'm a PHP dev. You, on the other hand, labeled me and entire PHP community as weak-ego, tribalists who frown upon other languages and that the PHP community, which apparently you researched somehow, is different to all other communities - which you also apparently researched. In this whole wall of text you wrote, you have't asked a single question. You merely stated something and then you proceeded to take up the higher moral ground and then demean people. Do you think such discourse is productive? > Fundamentally, this is a learned social behaviour, which means that whether or not individual PHP developers know other languages does not matter. A community that treats acquiring additional knowledge as a _threat_, seeing learning from the outside world as a _betrayal_, will not be able to learn _from_ other languages. In this very topic, I wrote about features I'd like to see in PHP - one being generics. Something I learned in C# and something that changed my entire stance to JS because of having used in TypeScript. That's just _one_ example of how you assume without zero facts to go by. I won't bother listing what we do for feature suggestions in PHP, which languages have great features and what we do to bring them in. You're just incapable of reading and you merely recognized me as a "bad guy" because I called someone out. I seriously doubt you'll read this, it would take more than 13 seconds of attention and that's something hard to acquire these days. TL;DR: nice gaslighting and straw man, thanks for ad-hominem, I wish you well in the new year :)
- tored 4y ago> extremely common in the PHP community? If I'm going to guess is that you have interacted with non-professional and/or beginner level PHP programmers, they could feel threatened becuase the only development skill they have is rudimentary PHP and you are asking them to replace that with something much more difficult. I have seen some of it myself, and it has always come down to lack of skill. And this makes sense why you have encountered this within the larger PHP community, becuase PHP is an easy to learn beginner friendly language that is used by the majority of blog and forum systems, zero setup web frameworks, and all of it can be set into production on almost every server on earth. Thus there are many low skilled PHP developers, probably more than moth other languages. And this is the lessons, it is important to understand that every community consist of large variety of disparate groups, especially within the PHP community, and it is up to you to learn to distinguish them. Unfortunately many are blind to this when it comes to the PHP community, outsiders may think the work I do professionally is the same as someone setting up blog for the first time, just because we use the same language. It would be same to think that the result of a first grader learning to write is the same thing as Tolkien's writings becuase both are in English.
- sbarre 4y agoCurious about something. If you've long moved on and are no longer using PHP, why do you still consider yourself a "detractor"?
- IgorPartola 4y agoFor me PHP 4 and 5 was an experience that left me feeling gross. I had to go home and work on personal projects trying to figure out a way to write beautiful code to offset the ugliness I encountered every day at work. I still occasionally work with PHP for WordPress and it is still mostly not great. The mess of abstractions, the JS-like library installation system, the lack of any kind of concurrency, the mess with errors vs exceptions. It just isn’t a language that makes me happy. Then again, I dread opening a .php file so maybe it’s a preconceived notion.
- mgkimsal 4y agoIt's the 'wordpress' part of PHP that is 'mostly not great'. Projects started in the past few years with any major framework will generally be cleaner and easier to understand, and easier to extend with composer/psr interop.
- motogpjimbo 4y agoI think you're putting too much faith in frameworks there. My employer's large PHP application is written in a framework that was once popular but then was abandoned years ago. Since that framework defines every aspect of the application, down to the directory layout, migrating away from it towards a more recent framework is largely impossible at this point. While it's true that the framework is "easy to understand", it's also true that it encases the application like a concrete coffin. Libraries are infinitely preferable to frameworks if you want your application's life cycle to be independent of $POPULAR_FRAMEWORK's. Even with Laravel, which is the current thing in the PHP world, I've worked in multiple teams where their application is written in a very old version of Laravel and there's no desire to attempt an upgrade to the most recent version.
- nathell 4y agoIs there still a php.ini that allows you to alter the language’s semantics? To me, that’s the biggest can of worms that PHP used to have. I haven’t touched it in years, so am not up to date.
- trillic 4y agoYes. Looks like the canonical use if for ENV vars though? https://www.php.net/manual/en/configuration.file.php https://www.php.net/manual/en/configuration.file.php
- nolok 4y agoNot really. You have a php.ini that can configure some behavior, but most of what was horrible is either deprecated or straight up removed (register globals, ...)
- lazka 4y agoassert() is still broken if it's disabled in php.ini.
- nolok 4y agoI mean yes php.ini allows you to disable any function you want, and if you do that then this function doesn't work like expected, I can hardly blame php for that.
- hakre 4y agoYes, that's fully true, but does specifically assert() falls into that category?
- hakre 4y ago> assert() is still broken if it's disabled in php.ini. Care to explain what you mean it's broken if disabled? That it is disabled (noop in runtime) so you're missing it? AFAIK that's the production setting. You should be able to enable it in build/test/ci/development, just how you want it.
- sebstefan 4y agoThere's less and less wrong with it as we go along, but seriously there's still so much crap... You could list so many other than preg_match >sleep(int $seconds) >returns zero on success. >If the call was interrupted by a signal, sleep() returns a non-zero value. On Windows, this value will always be 192. On other platforms, the return value will be the number of seconds left to sleep. I've used it for 2 years 2 years ago and I'm not at all interested in starting a project with it again
- mgkimsal 4y agoYou must have more than just 'sleep' bothering you. What would you start a project in today?
- sebstefan 4y agoWhen I was using it, I had a novel's worth. Now I mostly forgot my rant The projects I start today got the php replaced by typescript
- donatj 4y agoA little weird, but it was documented. PHP is nothing if not amazingly well documented. This is more than I can say for a lot of languages I have worked in cough Ruby cough. I work pretty heavily in Go these days and even it’s docs leave me wanting in comparison sometimes.
- apocalyptic0n3 4y agoIt is well documented but the comments in the documentation are seriously bad most of the time. I really wish they would at least designate the primary release at the time of the comment, if not purge old ones (the comments from 2005 don't often offer much value nearly 20 years later)
- sebstefan 4y agoIf documenting was enough band saws would still just have warnings about fingers in their manuals instead of guard rails. "Weird functions" need to have big yellow warnings at the top of their doc with a link to fixed versions of the func
- osrec 4y agoThe truth is, no language is perfect. PHP just happens to be good at getting stuff done fast, so it's found all over the place, and thus has a lot of eyeballs on it. The negativity is a byproduct of it's usefulness and staying power - the price of popularity, if you will. I love PHP, especially with the new event loop based modules that let you do things asynchronously, much like Node or Go. If you know how to use it well, PHP is awesome, and it's getting better with each release.
- PaulHoule 4y agoPHP was the first open source language in which just anybody could write server-side web applications without terrible management problems for the sysadmin. First people wrote cgi-bin scripts in Perl, which were not efficient because they forked a process for each request. There was mod-perl which was more efficient but prone to memory leaks. A few people wrote cgi (or fast-cgi or Apache module) programs in C/C++ but that was insane since a return after a 𝚜𝚝𝚛𝚌𝚙𝚢 is Turing complete in C and there weren't any mitigations for this in the 1990s. PHP opened the door to cheap web dynamic web hosting and in turn you had self-hosted applications like Wordpress. It was a few years later that languages like Java and C# became really attractive for back end work, you also had Ruby, Node, etc. I wrote a lot of PHP in the early 2000s because that is were the work was, that’s what you could write open source code that people would use in, and it was really straightforward to build apps (like a social network for a secret society) without an ‘ops’ team watching your every move.
- daveslash 4y agoThis is a refreshingly nice, informed, and balanced perspective. I've only done PHP for small personal projects and some wordpress hacking, and that was years - so my experience is limited. But it seems to me that one of the great and tragic things to PHP is the low barrier to entry. As you put it: "first open source language in which just anybody could write server-side web applications without terrible management problems for the sysadmin". This made it extremely easy for anyone in the early 2000s who signed up for a web hosting account on godaddy/hostmonster/hostgater/etc... to fire up a text editor of their choice and start slinging code and FTP'ing up to a server. Didn't have to worry about installing, configuring, all the dependencies, build tools, etc... just edit, upload, refresh -- lather, rinse, repeat until it works. Lowered the barrier to entry, and got a lot of people into the field. Really powerful stuff. It also made sloppy, hacked-together, copy-pasta code very prevalent. In my limited perspective, I suspect that this prevalence of sloppy spaghetti-code has contributed to PHP's bad reputation. It's not that you can't do good code (totally can!), but a PHP environment can be forgiving of some pretty bad practices.
- porker 4y agoFor the order of function arguments: sounds like you'd enjoy https://github.com/azjezz/psl https://github.com/azjezz/psl. Yes it's a userland workaround and not a fix for the language, but it's thinking about these issues and a PHP extension (offering better performance) is being talked about.
- user3939382 4y agoYep that's a great library, I'd like to see some of it in core. Same with this: https://github.com/lstrojny/functional-php https://github.com/lstrojny/functional-php which overlaps somewhat. The no-brainers to me are the missing array_some()/array_any() array_every()/array_all() and an array_search() that takes a predicate and iterable. I do these now in userland but an optimized native version would be nice.
- zmxz 4y agoPHP 8.0.0 introduced named arguments which allow for arbitrary argument order. That was nearly 2 years ago exactly to date. What does that lib do that PHP doesn't?
- withinboredom 4y agoThat lib probably makes any seasoned php dev really confused or think everything is backwards and somehow still works.
- bawolff 4y ago> My biggest gripe at the moment is the (very old) behavior of e.g. preg_match()... Do you mean how you can have an optional out parameter to get more detail than what the return parameter gives for which group matched? Personally i dont see anything wrong with that, but to each their own.
- felipellrocha 4y agoHave you considered that these "detractors" might just be former users of the language themselves, who felt liberated once they tried something else, and want to help other people not feel stuck as well?
- giraffe_lady 4y agoRight but if someone stomped in here talking shit about for example javascript's verbose function notation, poor linting tools, and lack of type checker we'd be like what year are you from? We all got burned by that stuff, we all hated it circa 2016, it's all been addressed now. Javascript still has problems but those aren't it and any conversation about it includes that nuance. Php is in a very similar situation, the difference is you can't escape javascript so we all to some extent keep up with its developments. People who leave php left it at a certain point and their understanding of its issues is frozen there. It's very predictable and boring honestly.
- xigoi 4y agoSince when does PHP not have $?
- nerdbert 4y agoWhat's the problem with '$'?
- xigoi 4y agoFor me, it makes code harder to read because my brain can't stop pronouncing it as “s”, so something like `f($x, $y, $z)` reads like “eff sex, swy, szee”. And for writing, requiring a shifted key before every identifier is a lot of pinky strain. Not to mention that it's completely useless noise.
- dncornholio 4y agoLife is too short to care about stuff like this. It's like saying you don't like the color blue.
- vanillax 4y agoI feel the same, but for Java.
- cogman10 4y agoYeah, the `InternalFrameInternalFrameTitlePaneInternalFrameTitlePane MaximizeButtonWindowNotFocusedState` jokes get a bit old. Non-java devs think of java as Java 6 when in reality it has pretty significantly evolved in the last decade. I dare say that it's one of the most rapidly evolving mainstream languages on the market at this point.
- pie_flavor 4y agoMost Java devs are on Java 8, because of how much Java 9 broke reflection, classloading, etc.
- cogman10 4y agoThat's something that will likely change pretty rapidly. Springboot 3 is forcing Java 17 which is going to force a lot of conversations once 2 is fully retired. (free support for 2 ends next year) The Java 8->11 transition was rough but honestly after that we've not really experienced a whole lot of pain. 16 has been a little bit of a pain as well since it closed some more unsafe holes. I think that's the last release, however, that's going to cause major headaches with migrations.
- no_wizard 4y agoI think Kotlin will see a nice rise in adoption, as the refactoring seems big enough to warrant moving to a language that embraces certain semantics and remove some magic. I'm speculating though.
- cogman10 4y agoKotlin, IMO, is experiencing the Ruby on rails effect. It's getting strongly associated with android development which has somewhat stifled general uptake of the language. Java has been slowly adding the best kotlin features (such as data classes, records) which also makes it a bit harder to sell. That said, I've introduced kotlin on a few teams and pretty much everyone that's worked with it has complimented it.
- pmarreck 4y ago> The worst part about PHP is constantly hearing from its detractors Does it deterministically pass ALL tests in its own test suite yet? 100% of the time? This was the state just a few years ago, where a lot of tests were simply disabled because they were "flagging". <insert eyeroll emoji> (I'm not even going to touch the Boolean chart showing the different behaviors of single, double, and triple-equals on results. I know a lot of that has been fixed, at least by "convention".) Nondeterminism is literally the worst trait of a computer language, because it leads to the worst kinds of bugs- the ones that are NOT a result of your lack of understanding of how the code is supposed to work at the PHP level. I've literally burned months away in my career in tracking down bugs like this (in Ruby and other languages), which ended up being framework or language bugs. There comes a point when you say "never again". Unfortunately, it comes too late in most people's careers to realize they've made a mistake, and switching to another language/community becomes too expensive/risky a proposition for them. (In my case I've been fortunate in that I was able to switch from .NET, to Ruby, to Elixir... each one of these was a difficult transition, both intellectually and socially (I really miss the Ruby community!), but in the end, completely justified in my case.)
- evo_9 4y agoLearn SugarCRM which is built on PHP; SugarCRM devs are rare, in high demand, and very highly paid (I just hired a full remote sr php dev at 145k with full benes/10% starting bonus). We’re always looking btw.
- boredtofears 4y agoThat's lowish to mid $$ for a senior dev (at least in the US).
- tomnipotent 4y agoFAANG-level pay is the exception.
- boredtofears 4y agoFAANG level pay is well over $200 for a senior, easy. There's plenty of companies offering senior comp in the 150-200 range that aren't faang.
- tomnipotent 4y agoTotal comp yes, not salary like OP is talking about. Only a handful of companies have total comp that doubles base thanks to RSU and stock, which a vast majority of the worlds ~25MM programmers do not participate in.
- boredtofears 4y agoNope, I mean base salary not total comp.
- tomnipotent 4y agoIt's amazing how skewed the HN crowd is on developer comp. You'll find that $140-150k is senior range for a vast majority of the U.S. software engineering market.
- trollied 4y agoPeople don’t realise that it powers the majority of sites on the internet. It’s got a bad rep from security flaws in the late 1990s. Things have moved on since then. It does the job.
- 36amxn36 4y agoPHP is simply awesome, so much so that I have to make a huge effort to remember that other backend languages even exist.
- gosukiwi 4y agoThere are two types of programming languages: Those everyone complains about, and those nobody uses :)
- yrgulation 4y agoThe biggest issue with php is the developers. Many of whom are totally oblivious to engineering practices and just reinvent the wheel. 1 in 5 still debate setter and getters while the rest still argue over using spaces over tabs. All in all a very toxic culture.