I've heard that php switch uses loose comparison. But what is the logic behind this behavior:
$var = 'default';
switch ( $var ) {
case 1:
echo '1';
break;
case 2:
echo '2';
break;
case 0:
echo 'unexpected, huh!';
break;
default:
echo 'default';
}
It echoes the result under the case 0! Why does it think that the 'default' string is equal to 0?
Sorry for my English!