Serious question: why all the hate on PHP?

I've been using it as my main language, and genuinely like it. Tried Java but find that to be typing a fuckload to get the same task done. Javascript is nice, but still, i prefer PHP (probably mostly because i know it).

Just really curious, what have i been missing?

  • 0
    I use PHP a lot, and except for small trivial programs I don't know how PHP is less verbose
  • 7
    Short answer: Because we have seen so much shitty code written in PHP that it's hard to imagine it being used to write good code.

    Long answer (more of a list of issues):
    -It is very easy to "learn" so even incompetent "developers" can and will use it. This is quite an inconvenient for people that do put effort into their craft since it lowers prices (why should I pay you this amount when X will do it for 10% of that - most clients will not know the difference between good and bad code), creates a bad perception of our trade when clients face the problems created by the cheap coder they hired, etc.
    -It is not as formal as C#, Java or other languages and that allows for code that is poorly written but seems to work fine. (i'm not saying that is not possible in these other languages - just a bit harder).
    -Performance is... bad.
    -It was first designed as a scripting language and then hammered in the current role. As such, it lacks a proper architecture for the purpose.
    1000 chars limit...
  • 2
    While i've only used PHP a little bit, i've always found it wasn't great at adhering to standards, and everything was just a little different.

    Case and point: https://reddit.com/r/lolphp/...
  • 1
    @SnafuAI performance is good these days btw with php 7 😄
  • 1
    @SnafuAI Ah, so its mostly the hate on junior PHP devs and 'code factories' (rather than development companies). I do recognise this in a lot of devs i've been working with, but i like the freedom I have, wile i do enjoy to create a very strict OO-architecture.

    Thanks for the answer! :)
  • 1
    I am sure the speed improved but I guess it's still slower than Java or C#.
    Also, what's the install base of PHP7 compared to 5 and 6? I'm more than sure that a lot of sites still run on older versions.
  • 0
    @SnafuAI Speed in PHP7 is actually quite decent, even though Java and C++ can be a lot faster.
    sauce: https://blog.famzah.net/2016/02/...

    Hardly anything runs on PHP7 at the moment, but i've been getting the feeling the last few years that PHP 'is getting there and growing up'.
  • 1
    I'm not talking as much about junior developers - those will make mistakes, indeed, but they get better - but about people that will call themselves programmers even though all they do is use copy/paste from StackOverflow and similar sites without ever bothering to understand what it does.

    You can write bad code in any language, but somehow PHP attracted a lot of unskilled wanna be "programmers".

    Also, I understand your question very well - I am a Java developer (another language that gets a lot of hate).
  • 1
    @SnafuAI guessing you'll find this an interesting read:
  • 3
    PHP is quite badly designed and contains lots of inconsistencies and caveats that make it quite annoying to work with.
    Functions with configuration dependent behaviour, overall shoddy unicode support, functions with misleading names, etc all contribute to make developers job harder.

    Its not a huge problem on small projects targeting english speaking users but for big projects where some devs will be less experienced it is a pain in the arse.

    I've rejected 4 pull requests this week because junior devs used str_ functions instead of mb_ functions, 1 due to incorrect use of empty and 2 due to implicit typecasts in switches (switch does its comparison using == rather than the stricter === so most of the time you want to do switch(true) {case $foo === $bar: ...} instead of switch($foo) { case $bar: ...}, all of which are mistakes that simply can't be made (or atleast are harder to make) in modern languages.

    This all results in a huge waste of time for senior devs and a lot of php hate.
  • 1
    Because node is bae
  • 0
    @SnafuAI although I haven't run any benchmarks or anything but I am 90% sure PHP7 with a framework like Phalcon which is a installed as a C extension can be just as fast if not faster as C# (ASP im guessing) or Java (no clue haha). So if you know what you are doing its definitely faster/better in my opinion ☺
  • 0
    The question is what would you write in PHP that wouldn't be more fun, more efficient, and done in a more modern way using JavaScript?
  • 0
    Personally love it as well as js!
Add Comment