It’s all down to typing system. In PHP, providing null to string argument is a TypeError. You have to use ?string. Same in Typescript in strict mode. In Java, you can happily use null for everything without typesystem catching it.
NaN is a float standard thing, every language that implements floats has NaN.
It’s all down to typing system. In PHP, providing
null
tostring
argument is a TypeError. You have to use?string
. Same in Typescript in strict mode. In Java, you can happily use null for everything without typesystem catching it.NaN is a float standard thing, every language that implements floats has NaN.
In my 18+ years as a PHP developer, I never once knew (at least afar as I can recall) that PHP supported NaN. TIL.