Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4681467yGood 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. -
C0D4681467y@dcode
Probably for the same reasons a colleague of mine has to trim constants and defines 😟
These things should already be correct 😓 -
dcode4287ySorry 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.
-
C0D4681467y@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 🤣
Related Rants
-
linuxxx32*client calls in* Me: good morning, how can I help you? Client: my ip is blocked, could you unblock it for m...
-
DRSDavidSoft28Found this in our codebase, apparently one of my co-workers had written this
-
Korvax31Italian chef: We have the best spaghetti in the world PHP developer: I doubt that
TFW you learn that trim(null) equals empty string in PHP.
I´m starting to understand why people seem to dislike PHP.
undefined
php
wtf
nonintuitive