by xellisx · 6y ago · 0 comments
null === 0 is false.
false == 0 is true.
false === 0 is false.
null == false is true.
null === false is false.
null < -1 is true.
In C you can write i[t] instead of t[i], but don't do it.
I guess it's true for many languages. These funny features don't prevent you from writing good code, especially if you enforce some coding styles that will catch any unintended use of these features.
Blame PHP for what you can't do with it, or for things you don't like but are forced to do. For instance I like PHP but I cannot type things the way I'd like. It's getting better though.
I don't like the inconsistencies in the function names of the standard library but the functions are often straightforward and very simple to use. And, above all, the doc is good. These aspects mean I don't waste time figuring out how to do simple things because of a complex interface involving many classes, despite the inconsistencies.
I also don't like the dollar notation for variables but that's a matter of taste, nor the syntax for namespaces, nor the implicit declaration of variables (like in Python by the way).
I had to check this myself. I'm astonished.
*(t + i)
So you can see how swapping that around to `i[t]` is effectively the same operation: *(i + t)<?php
if (null > -1) { echo "null > -1\n"; }
if (null < -1) { echo "null < -1\n"; }
if (null == -1) { echo "null == -1\n"; }
if (null === -1) { echo "null === -1\n"; }
if (0 < -1) { echo "0 < -1\n"; }
if (0 > -1) { echo "0 > -1\n"; }
if (0 == -1) { echo "0 == -1\n"; }
if (0 === -1) { echo "0 === -1\n"; }
results:
null < -1
0 > -1