• 0 Posts
  • 22 Comments
Joined 2 years ago
cake
Cake day: June 18th, 2023

help-circle





  • Decq@lemmy.worldtoProgrammer Humor@programming.devPeak code reuse
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    3 months ago

    If string return nan, else % 2

    So now you return a number type if it’s a string and a boolean if it’s an integer. How does that make sense?

    The is-even lib exists to sanitize input by throwing an exception which imho is better.

    Edit: having looked at the code better. Apparently it still allows string coercion (boo). It only checks for non integer numbers.












  • It’s been about 20 years since I’ve touched PHP. So i don’t remember all the problems i had with it.

    But some language from those times were at least consistent with itself and clearly more thought-out. Even though they might miss some of the nicety we’ve come to like nowadays. Of course for web development there weren’t many better choices back then.

    But I’m heavily skewed towards non-oo, static typed, explicit languages so PHP was probably never for me.