Why do people hate php? It feels so nice to me.

  • 1
  • 4
    It's right in the name
  • 18
    I don't really hate it, I just don't really like it, for some of the same reasons I'm not crazy about node.

    - arrays that do way too many things
    - variables require dollar signs
    - variable variables
    - no multithreading
    - inconsistent core APIs
    - 3000 line files in every legacy system I've ever had to convert to something else
    - poor/non-existent type system
  • 1
    @electrineer totally, my friends and I say that php stands for "Perro HijuePuta", in english roughly mean "dog son of a bitch"
  • 0
    from the little I messed with it I enjoyed the syntax and the docs
  • 1
    @linuxxx is the biggest PHP fan I know, He might know.
  • 1
    @uyouthe hates PHP too, he might know
  • 8
    @theabbie I slightly understand why people hate it but you can work around most issues easily. Also, PHP 8 solves a lot of stuff that people hate right now!
  • 13
    i dunno, pays my bills without much bs really, I know it's quirks enough to not get bitten in the ass and as far as web solutions go I can do everything with it. I really don't mind the syntax. By the time other people are done spinning their own environments for whatever solution I am already done. I don't have much time for neckbearding really and this is just a fucking job to me, not a craft or an art etc.

    I have come to find very few environments I work with that I disliked, heck, I even worked on classic ASP and personally loved fucking around with VBScript.

    Nitpicks over things that a language can, cannot do only take you so far, all of the other mfkers here act as if they were all building google and shit. it's a fucking website with dynamic content ffs what most here do.

    php is fine, all languages are fine really, and in web no one knows if your server side implementation is built in Lisp, so who fucking cares?
  • 0
    @linuxxx It might be difficult for someone to move on who has always used it.
  • 2
    We were kind of building Google at Google though 👀
  • 0
    Well, php paid my rent when i was a freshman so no hate there...

    I don't really know if the multithread thingy got solved or not but it was relevant at the time for my projects, so i did java and c#. Also ide support was a mess (dreamweaver anyone?)
  • 1
    @theabbie what do you mean?
  • 0
    @100110111 People who have been using PHP since forever might accept it's flaws and refuse to move on even if the alternative is superior.
  • 0
    People hate older versions of PHP (which were truly sucky), and the legacy systems written in older versions or by peeps having no clue what they were doing. It's easy to write somehow working shit spaghetti in PHP, and I think that's what most devs associate PHP with. Also WP.
  • 1
    @theabbie if you're talking about JS, we've had this discussion already.

    But you have half a point there: I know of PHP devs who've stuck with the PHP 3 or 5 way of doing things and have refused to / are incapable of taking advantage of the niceties brought about with PHP 7. That's a sad breed, but hey, if it brings bread to the table and that's all you care about, why not?
  • 1
    @100110111 I have no problem with PHP, I will stick with node.js though. If a lot of people hate something, there must be something wrong with it. It's no big deal.
  • 1
    @theabbie also, every language has its flaws. So whatever you use, you'll eventually have to accept them. That being said, PHP is not my fav lang, but I enjoy working with a well-written PHP codebase much more than I enjoy working with, say, C# or JS (or - *shudders* - Python).
  • 0
    @100110111 All old languages are equally hated, these are traditions.
  • 2
    @theabbie Hey, i still love c++
  • 0
    Pretty sure I wrote php once and that was enough
  • 2
    PHP has many flaws. But back then, it replaced PERL and C/C++ for web backends.
    I don't really like PHP, but i hate PERL and the C languages, so i learned PHP.
    Today, PHP is orders of magnitude better than back then.
    But there are better languages for the web now.

    So if you start today: Don't go the PHP route.
    Pick one of the modern languages with a consistently designed standard library and a type system and paradigm alignment of your choice.
    Today you have the choice. It isn't PHP or PERL anymore.
  • 1
    @Oktokolo while I'm all in for PHP, I have to agree and disagree. PHP has been so widely used chances are you might end up working on a PHP project - or how I ended up: the only openings I could apply to were PHP projects. Knowing PHP brings bread to the table. However, if I were to start a new project, I wouldn't use PHP: ideally Rust instead, or out of the languages I know - F#
  • 0
    Yeah that’s how it gets you :P
  • 0
    @SortOfTested i have no clue what that means
  • 0
    I wasn't sure if I was included in, "all of those other mfkers" 😋
  • 2
    @SortOfTested i am still lost lmao, you say that as if I was somehow familiar with your work history of something, meaning: I have no clue why would I include you in that sentiment or not.

    Anyone here is more than welcome to neckbeard over languages. Ill just collect my paycheck and go home. Elitists make me get more money, the more "ew, node/php/rails/node" stuff I see the easier it is for me to pick up quick and easy side quests that give me some extra bucks.
  • 1
    That comment makes no sense. Are you feeling okay? How many churros am I holding up? Did you find my stash? Can I have it back? 🤔
  • 1
    If someone has to choose whatever the only available job demands, it doesn't matter what anyone of us has to say about it of course.

    But even then that one still shouldn't choose PERL or "highlevel" assembly as starving is the less painful death...
  • 0
    @jvillavi C++ is perfection, a state-of-the-art Language, Don't compare it with newbies
  • 2
    @theabbie About being difficult to move on even though alternatives are superior:

    At work, I use two languages the most: PHP and Rust.

    I would say I'm pretty much "fluent" with both, have been using PHP since '95, and moved from Haskell as my primary strongly-typed language to Rust about 3 years ago.

    I am not sticking to PHP because it is difficult to move on -- instead I make a pretty thorough choice for each service/tool.

    Our core monolith is huge, maintained by over 100 developers. It's difficult to hire 100 Rust developers, even in a large city full of hipsters.

    So why not Java, or Clojure, or ...? PHP devs are easiest to find, and PHP devs start at a salary which is affordable for HR, especially if it's x100.

    So, I've rewritten several bad PHP cron scripts in Rust. I've rewritten our financial services in Rust. I've built some proxies and a bunch of image recognition tooling in Rust.

    But each time, the decision is based on "can I afford to hire a team to maintain this".
  • 1
    @theabbie C++ is perfection, ha, good joke! 😆
  • 0
    @bittersweet That proves it is difficult to move on
  • 0
    @bittersweet That came out of jealousy, didn't it?
  • 1
    @theabbie how does it prove it's difficult to move on? Don't start with this bs again... (especially not the jealousy bs)
  • 0
    @100110111 That Reply wasn't to your comment, Anyways, difficulty in moving on is a fact.
  • 1
    @theabbie I answered on @bittersweet 's behalf, as I smell bs.

    The difficulty of moving on is, in fact, not a fact at all. You'll have to elaborate on WHY it would be so...
  • 0
    @100110111 If someone is using a language for years, they wouldn't want to use something new, they might use out of necessity, but they will prefer their old language. PHP is a good example because it has existed for very long. The Flaws in PHP were solved in PHP 8, so, now they will use PHP instead of any other language. Current generation doesn't have any affection towards any language, that's not the case with PHP.
  • 1
    @theabbie that's a valid argument for unwillingness to use something else, and I would not claim such devs don't exist. It's not a valid argument for difficulty to move on, though. Also, I don't think moving on is the correct expression here anyways, as it implies leaving PHP in the past in favour of other languages. I firmly maintain my position that PHP is a great tool for the job it was designed to do, and hence is perfectly valid to be used for that job.

    Any good dev, given the choice (I remind you, not in every case are you given a choice) will use the best tool for the job available in their toolset. It may be PHP, it may be Rust, it may be F#, or even JS or Python.

    (Also, PHP 7 already fixed most of the issues with the lang)
  • 0
    @100110111 Most of the time it's not about best tool, if all languages are capable of performing equally good at a point and a choice is given, Developer will choose the one he is best at. I refer difficulty as unwillingness, any dev is capable of using any language, but they might not want to do so.
  • 1
    @theabbie will they, though? Then why am I writing something in F# that I could write in PHP, since that's what I'm "best" at?

    There are several reasons for choosing a language. In company environment, when you have other devs' skill sets to think about, and possibly the ease of recruitment, you'll choose a language that is either easy for any dev to learn or something there are devs easy to find. That's where PHP is strong where newer, more exciting languages, or niche langs, are not.
  • 0
    Same. PHP was one of the first languages I started out with, so even though I don't really use it anymore I'm still pretty fond of it.
  • 0
    For the same reason, people are going to hate MERN stack in the next decade.
    The reason why people like MERN stack now is because it took shortcomings of previous era technologies, improved them and simplified our life as a developer at present.
    But there's always scope to improve further. Just as we are seeing the rise of new technologies like Deno and Vue which are improving dev ecosystem further.
    Nothing is good or bad, all these technologies are just a part of the gradual evolution of overall development ecosystem.
  • 0
    @AleCx04 it's cuz.....

    PHP bad reeeee 😂😂
  • 4

    I'd personally throw PHP, JS and Python in the same bucket. They use slightly different paradigms, but learning those boils down to:

    Understanding basic data types (string, bool, list, int, etc), basic logic constructs (branching, looping), basic organizational constructs (functions, classes/modules, packages).

    That's it. You learn it, and it's like a swiss army knife. Useful all the time, cheap to deploy and maintain.

    Above that, you can branch in two directions: Lower level mechanisms, and higher level abstractions.

    Java is a mild step up from PHP in the direction of higher level abstractions. Suddenly you got a compound type like Tree<Node>. Kotlin, Clojure and Swift are a step up from that in my opinion, as they scrape away a bunch of the nonsense.

    Haskell is S-tier abstraction — you manipulate XML into JSON through typesafe, modular lenses, projecting one format into another. With some care it performs extremely well, but low level — well, there's still a garbage collector.

    You also have to learn about monoids, functors, hylomorphisms, type kinds, etc; Suddenly it's not just strings and bools anymore.

    C is S-tier low level. It has been around for ages, which means people have a lot of stuff figured out. But in terms of higher level abstractions... Yeah safe error handling through monads is not a thing. You don't need to know about composable arrows or prisms, but you do need to know the difference between stack and heap memory.

    The reason I like Rust is that it marries the ideas of Haskell and C, providing a GC-free toolkit of type safe development.

    That means you need knowledge of both high and low level concepts, which makes it an awful language for newcomers.

    And that's why PHP is kind of amazing: It's the most basic OOP language there is, kind of simple, kind of structured. Far from perfect — but it doesn't require 150+ IQ to master and thus it's easy to hire for.
  • 0
    @bittersweet I wish I could ++ your comment more than once... but you forgot to add that PHP is not restricted to OOP - you can go FP, too!
  • 0
    Honestly a big part of it is legacy code that was written horribly, and the abundance of amateurs fucking around with wordpress without knowing a thing about actual development

    PHP 8 feels pretty good to use if you don't spaghettify it on purpose
  • 1
    While PHP does have all the bullet points strictly needed for FP, you still really see at a glance that whoever made it, does not do FP himself.

    Functions are firstclass citizens, but they are passed around as one of the following:
    - A string for named functions and static methods.
    - A 2-tuple for a method of an object.
    - An actual Closure object for an anonymous function or bound method.

    The syntax for anonymous functions is overly verbose before PHP 7.4 (wich adds the fn keyword and removes the need to "use" every outside variable that is to be used in the closure).

    There is no tail call optimization. So a lot of the classic functional algorithms streightup run into a stack overflow.

    Hmm, the list definitely got shorter over the years.
    Maybe, PHP will truly embrace functional programming in another decade or so...
  • 1
    php is ni... well... not nice, but not entirely horrible. just medium bad.

    the problem is projects in php. they are horrible. why? because php doesn't enforce any structure, so any hillbilly can pick it up (and usually does), sees how nice it is, starts randomly writing code, and in a month finish with a monolith that nobody will ever understand again ever.
  • 1
    basically there's two types of languages, kinda:

    languages for dumb people, which enforce a rigid project structure, at least to a degree. and by doing that, they prevent dumb people from shooting themselves (and everyone else on earth) in the foot.

    languages for smart people, which don't enforce any kind of structure, and by doing that, let smart people tailor that specific project's structure to that specific project's needs.

    problem is that languages for dumb people, due to their constraints, are hard for dumb people to learn, and vice versa, languages for smart people, due to lack of constraints, are easy for dumb people to pick up, and too loose for smart people to use.

    and so smart people choose to use languages for dumb people precisely because of the features aimed at dumb people, and dumb people choose to use languages for smart people precisely because of the features aimed at smart people.

    yes, this comment is 95% a joke.
  • 0
    php is like ghetto part of town. You know a lot of people live there and you hear only horror stories about being mugged etc, but you haven't been there yourself.
  • 0
    @Oktokolo While it's not strictly an FP thing, I feel like compound types are missing from PHP.

    Methods are Functions, Classes are Types. Composing both functions and types is a central theme to FP -- you don't inherit, you Typeclass your Types (Haskell), apply Traits to Structs (Rust), use Mixins, whatever.

    That means your Types must be composable.

    In PHP, it's doable to make a Graph class whose Nodes are either Humans or Cats -- you apply an Interface to Humans & Cats, "implements Nodeworthy" (because you have a dumb sense of humor). Graph constructor uses Nodeworthy typehint on "addNode" function, neat -- although you can now have both Cats and Humans in the same graph.

    Try writing a method which takes a "Graph<User> | Graph<string>"...

    There's a few composer packages which attempt to implement a bunch of FP concepts, and while impressive, calling it syntax abuse is an understatement.


    Check [(+3),(+4)] <*> [1, 2] == [4, 5, 5, 6]
  • 0

    I once wrote a complete MVC framework with middlewares, policies & a postgres ORM in nearly pure Bash script (just using awk for HTML templating & nc as a webserver).

    Doing FP stuff in PHP kind of feels the same 😄
  • 0
    Well, PHP's type system now is at the level of Java when it started. We only have unions in form of the option type and classic OOP interfaces/inheritance.
    PHP traits literally are just renamed macros - can't even declare interface implementation in them...

    I got the data-centric route a long time ago:
    I pass arrays around and manipulate them in functions or objects.
    The expressive type system train has long left the station for PHP.
    We definitely will get real union types soon. But it will never become OCamL though.
    We might get IDE smartness like in PyCharm at some day though.

    And yes, trying to do the more functional stuff does feel like you are doing it wrong in PHP.
  • 0
    @Oktokolo I'm kind of looking forward to being able to return a proper Result | Error in PHP 8.
  • 0
    I just gave up on generalizing intervals in PHP because there are no generics and everything else i can think about right now is way too clunky.
    Especially when not at full mental capacity a lacking type system really is pretty annoying...
  • 0
    Sooooooooo many reasons.
  • 0
    I don't hate PHP. It's just a language. I hate PHP developers. I know there are good ones but all the ones I know are worthy of extermination.
Add Comment