Functional programming case statement for PHP