2 ms·
I don't see why it should return null. If "" == 0, meaning "" is coerced to 0, shouldn't it coerce to 0 here too?
by ars 17y ago
I don't see why it should return null.
If "" == 0, meaning "" is coerced to 0, shouldn't it coerce to 0 here too?
- kingkilr 17y agoEquality isn't transitive in PHP :/. Of course, IMO, the real coding horror here is that in an error circumstance no exception is raised.
- prodigal_erik 17y agoThis. There are dozens of situations where, given instructions that simply don't make sense, PHP arbitrarily picks some half-baked behavior instead of giving an error. So much so that I think the original poster is out of line for even considering tax planning in a language that wants to guess what you might have wanted to happen!
- joeschmoesky 17y ago+1
- docgnome 17y agoWhile I understand (and agree with) the change to try and standardize PHP behavior, I think that in this case the parent comment is the crux of the issue. Seems like returning NULL violates the principle of least surprise to me.