9

So...

function watch($i = null)
switch($i) {
case 1:
return 'Game of Thrones';
break;
case 2:
return 'Silicon Valley';
break;
case 3:
return 'Fear The Walking Dead';
break;
}
}

echo watch(rand(1,3));

Comments
  • 3
    Using an array with a random index would be shorter 😉
  • 0
    You don't need break when you're returning anyway.
  • 0
    Why the default NULL value?
  • 4
    It's funny how we all are doing code reviews outside of our jobs
  • 0
    Haha we all love our work deep down! I honestly don't know about the Null value, I was told it was good practice by the senior at my last place :( is it not?
  • 0
    and dammit! Of course I don't need to break when returning! I blame that on using my phone to type code directly into the app. Well, and that's my excuse and I'm sticking to it ;)
Add Comment