
|
|
|
||||||||||||||||
IBM developerWorks : Web Architecture : Education - Tutorials![]() | |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
When using a switch...case statement, try to place the most frequently-occurring cases at the top of the list. This improves speed and efficiency for the most common cases. For example:
switch ( $user->writingHand )
{
case 'right-handed':
print 'User is right handed'
break;
case 'left-handed':
print 'User is left handed'
break;
default:
print 'Not sure whether the user is left or right handed!'
}
| ||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
|