1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php function test($bool) { echo $bool ? 'true' : 'false'; echo "\n"; } $true = array(1, '1'); $false = array(0, '0'); echo "-- True --\n"; foreach ($true as $t) { test($t); } echo "\n-- False --\n"; foreach ($false as $f) { test($f); }
1 2 3 4 5 6 7
-- True -- true true -- False -- false false