News for hackers. Stuff that matters.
Re:PHP Sadness by IgorPartola on Thursday November 29, 2018 @07:51AM (#18559800)
For me the biggest PHP sadness is always type coercion. ‘1’ and 1 are different things. And coercion into an array when you suddenly use [] is just insane.
Re:PHP Sadness by alphadevx on Thursday November 29, 2018 @10:20AM (#18560799)
It only appears to be "insane" if you are not used to working with dynamically-typed languages. PHP has been dynamically-typed from the very beginning, so you need to program defensively and check type at runtime (no assumptions are safe).
Re:PHP Sadness by IgorPartola on Thursday November 29, 2018 @10:21AM (#18560815)
These days I do 99% of my work in Python3 and JS/ES6. PHP is still the most insane version of this, though JS isn't far behind.
Re:PHP Sadness by evilduck on Thursday November 29, 2018 @12:25PM (#18561887)
Make the jump to including TypeScript in your toolchain, even if you don't ever intend to write any TypeScript.

The type checking it does on regular javascipt is still beneficial in catching and preventing a lot of coercion mistakes or attempting to accessing things that are potentially undefined.