8
nukasev
7y

TFW you learn that trim(null) equals empty string in PHP.

I´m starting to understand why people seem to dislike PHP.

Comments
  • 1
    Good ol’ trim()

    This awesomely crazy function will cast anything... int, float, ect.. to a string without leading and trailing white space.

    Best not to use it on anything you can’t handle being a string.
  • 3
    I still love php 😞
  • 1
    Why do you have to trim null? It's like shaving water...
  • 0
    @dcode
    Probably for the same reasons a colleague of mine has to trim constants and defines 😟

    These things should already be correct 😓
  • 2
    Sorry but still don't get it bro. If i ride a bycicle backwards with one feet and clapping with my hands then it doesn't really the bike's fault if i fall.
  • 1
    @dcode
    Hahaha not the bikes fault..
    It’s always the bikes fault until tests prove otherwise.

    Actually it’s pointless using trim for things that shouldn’t be trimmed, generally it creates problems when used incorrectly.

    Although PHP is forgiving enough to go

    trim(1.123) + trim(123.1);

    and still get it right 🤣
Add Comment