http://d.hatena.ne.jp/hnw/20080606 のリンク先の php-equal-test.tgz がなくなっていて試せなかったので、現状確認のため書きました
Last active
October 6, 2015 07:38
-
-
Save cho45/b7afadd615e454374a93 to your computer and use it in GitHub Desktop.
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 | |
<?php | |
$targets = array( | |
array(), | |
NULL, | |
false, | |
0, | |
"", | |
"0", | |
"00", | |
"0.0", | |
" ", | |
"\x00", | |
true | |
); | |
echo "<table>"; | |
echo "<tr><th></th>"; | |
foreach ($targets as $b) { | |
echo "<th>"; | |
var_dump($b); | |
echo "</th>"; | |
} | |
echo "</tr>"; | |
foreach ($targets as $a) { | |
echo "<tr>"; | |
echo "<th>"; | |
var_dump($a); | |
echo "</th>"; | |
foreach ($targets as $b) { | |
echo "<td>"; | |
echo $a == $b ? "<font color=green>true</font" : "<font color=red>false</font>"; | |
echo "</td>"; | |
} | |
echo "</tr>"; | |
} | |
echo "</table>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment