Get out of the switch
block before placing the final return
statement.
if you place
return
at the end of theswitch
block that way, theswitch
block already ends before it gets to thereturn
statement (because of the previous matchingbreak
statements).
The correct CODE will be:
// just in case $summary is not defined out side of the switch block
$summary = '';
switch ( $weather['icon'] ) {
case 'clear-day':
case 'clear-night':
$summary = 'sunny';
break;
case 'wind':
$summary = 'breezy';
break;
case 'rain':
$summary = 'drizzly';
break;
case 'fog':
$summary = 'foggy';
break;
case 'cloudy':
$summary = 'murky';
break;
case 'partly-cloudy-day': case 'partly-cloudy-night':
$summary = 'cloudy';
break;
case 'snow': case 'sleet':
$summary = 'snowy';
break;
default:
$summary = 'beautiful';
break;
} // end switch
return '<span class="weather">'.$summary.'</span>';