Created
December 5, 2017 17:08
-
-
Save arielallon/ad14a48fa81d84cdc8125279ae8bb000 to your computer and use it in GitHub Desktop.
Loose comparison of falsey types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$falsey = [ | |
0, | |
'', | |
'0', | |
null, | |
false, | |
[], | |
]; | |
$len = count($falsey); | |
for ($i = 0; $i < $len; $i++) { | |
for ($j = 0; $j < $len; $j++) { | |
$a = $falsey[$i]; | |
$b = $falsey[$j]; | |
echo is_array($a) ? '[]' : var_export($a); | |
echo "\t == \t"; | |
echo is_array($b) ? '[]' : var_export($b); | |
echo "; \t// "; | |
var_export($a == $b); | |
echo "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
results: