PHP Tricks: Multi-value match()

Submitted by Larry on 19 April 2022 - 11:41am

Last time, I talked about fun uses of the match() expression in PHP, using unconventional types of expressions on the right-arm branch. This time, I want to expand that discussion to include fun tricks on the left-side of the `=>`, and how you can easily match by multiple values at the same time.

I'm going to assume you have read the previous installment about how match() works and what an "expression" means. Also, I don't claim to be the original source of these tricks. I'm just documenting them because they're cool. Let's dive in.

Continue reading this post on Hive.