I have a snippet of code:
PHP Code:
switch (id)
{
case 1:
doFunction(parameter1);
break;
case 2:
doFunction(parameter2);
break;
case 3:
doFunction(parameter3);
break;
default:
document.write('Error: '+id);
}
The strange thing is that the document says, "Error: 3". If the variable id is equal to 3, then why didn't the switch statement go through case 3? I must have something confused.
Help anyone?
Bookmarks