0 == ‘foobar’ // true

0 == ‘foobar’ // false

Nuff said. Before you tell me that js also has quirks, just remember that js having quirks doesn’t make php less garbage.

  • 8
    Holy shit they broke coercion semantics?!?????? hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
  • 12
    I'm no fan of JS or PHP (backend and cloud infrastructure dev here, so I have never used PHP and try to avoid JS), but every time I see posts about weird comparisons enabled by dynamic types, I always have to ask, "But why would you even try that?"
  • 5
    It is garbage.

    But it's my garbage.
  • 7
    ... what does it say about me if i can't decide which variant is less nonsensical and my conclusion is "that's what you get for not being strongly typed, morons"?
  • 11
    PHP8 be like: Let’s see who’s code base is crap

    PHP Devs: Let’s all migrate to PHP 8, it’s so much better!

    Manager: Why is this taking so long?
  • 0
    what is 'foobar'? Reserved words?
  • 4
    Loosely typed languages will all have these kinds of subtle crappy typing issues. Breaking stuff in between versions is pretty awful, but imho the real problem is loose typing itself. I've never seen it done well - it's always a poor compromise.
  • 1
    I still don't get why some developers and engineers go "yeah we don't need a typing system just make anything truthy/falsy lmao"

    Like who looks at this goes "yeah that sounds good"
  • 2
    @LotsOfCaffeine Some Devs genuinely get confused with types, and so think the answer to that is to use a loosely typed language that just "handles it for them".
  • 5
    @AlmondSauce I believe there are many things a language can handle for us

    Like memory management, garbage collection can work wonders for many applications.
    Or multitheading. Async-await and parallel for loops are much easier and safer than manually tinkering with threads.

    Knowing what kind of data you're actually working with is not one of those things.
  • 1
    @LotsOfCaffeine I agree. Try telling that to a Dev who's never dealt with a strongly typed language though...
  • 3
    @AlmondSauce devs that get confused by using a type system shouldnt be calling themselves devs imho
  • 1
    if I remember correctly, it used to be that:

    empty string coerces to false.

    non-empty string other than "true", "false", "0" and "1" coerces to true,

    string containing the aforementioned coerces to the boolean value represented by that string.


    and it seems they've changed it to "everything except string expressions of those bool values coerces to false".

    a) I haven't worked with PHP for a very long time, and I wrote this purely from memory.

    b) I haven't read about the new way, I'm just making a huge ASSumption.
  • 0
    wow, that was probably the fastest reaction of any kind I ever got to any comment anywhere ever.
  • 5
    Nice nitpick.

    PHP8 is 90% fixed towards a decent OOP language.

    There's still quirks, but the speed at which the PHP devs are fixing legacy shit is amazing.

    You could have mentioned union types, match expressions, constructor promotion, JIT, but of course we focus again on a quirky relic.

    A quirky relic which, in my opinion, is now fixed, or at least improved. Even though weak comparison still sucks.

    And to those who yell AAAAH BREAKING CHANGE: Name one language which never had any breaking changes at major versions.

    I mean, C++ 17 removed the ability to do true++, and I like to ++ true statements.
  • 2
    Now that they finally got their beer and spirits together to break out of the breaking-change anxiety loop and do actually fix a major language flaw for good.

    People still don't like it. This time the shame isn't on PHP...
  • 3
    // PHP3
    0 === 'foobar' // false

    // PHP4
    0 === 'foobar' // false

    // PHP5
    0 === 'foobar' // false

    // PHP7
    0 === 'foobar' // false

    // PHP8
    0 === 'foobar' // false

    Doing shit that that the language specifically has guards against is just stupid and abusive. This is not a quirk.
    You can do shit with C to that results in unspecified behaviour or put in some nice race conditions in yo Python script and complain about how randomly crashy Python is... Yeah I hate JS but think the same about the type coercion flak it gets: it's stupid bullshit there is plenty of valid ways to make fun of the language.
    This is so beneath you.
  • 2
    Y’all soooo salty lmao 😂 it’s just a shitty language, there is no need to feel such a strong emotional connection to it
  • 3
    @kiki well looks to me calling it a shitty language already formed strong emotional attachment in your case..

    Also lol to everyone complaining how major versions shouldn't have breaking changes while that's one of main reasons behind those.
  • 2
    PHP 8: I gonna ruin this man's entire migration plan with this nuance! 😈
  • 0
    @myss what my case has to do with their cases? How exactly me being attached making someone else’s attachment less ridiculous? That’s an Uwe Boll argumentation
  • 1
    @kiki i think @myss sees it more as ironic or hypocrisy. You complain about people that are so into it that they have made up there minds and just don't see it. Yet you have so made up yours you are not objective either.
    Haven't seen that conveyed in an Uwe Boll masterpiece yet.

    @myss I'm really speaking for you so I could be totally wrong please correct me if I am.
  • 1
    @hjk101 but still, how exactly my hypocrisy if there is any makes php less garbage?
  • 0
    @kiki One man's garbage is another man's art.
    It's just your opinion and I don't think you are objective to be honest.

    To answer your question:
    Garbage === worthless or meaningless material or ideas; rubbish.

    By your needs to be so vehemently against it you prove it is the opposite of meaningless. By the industry that heavily invests and profits from it we cannot consider it worthless either. That just leaves rubbish and that is what I think of your opinion on this matter but it is also your opinion on PHP and I respect that.

    I just have an issue with the same old invalid arguments against it, and as you are one of the more knowledgeable people here I was a bit harsh. Would not call you garbage though 😉.
  • 0
    "there is no need to feel such a strong emotional connection to it"

    it's just a mound of shit in your backyard that you need to wade through 70% of the time when you're trying to get to your swimming pool, there is no need to feel such a strong emotional connection to it.

    i don't know about you, but I'm a programmer. so I would like my programming and programs, and work to not be shit. so I have emotional REACTION (not connection) to things that contribute to my programming, programs, and work to be shit.
  • 0
    @Midnight-shcode why defend it though?
  • 1
    Fuck PHP.

    At least 8 in the example makes more sense.

    Major versions are meant to break backwards compatibility anyways.
  • 0
    Hum.. === ? No ? You wouldn't care at least using it properly right ? Fine.
Add Comment