I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
You've made the switch version look more verbose by changing return to echo, meaning it's no longer the same code as in the first example. If you were refactoring the first, you'd do:
You've made the
switch
version look more verbose by changingreturn
toecho
, meaning it's no longer the same code as in the first example. If you were refactoring the first, you'd do:That could do with a
default
, of course, but you know what I mean :)You're totally right! I should update that! Thanks for mentioning it :)