the result is basically the same, but match is more of an enclosed switch that just returns instead of does side effects, then you can do what you like w/ that.
Ymmv, but match is a great code saver, and is very nice for enums and methods on enums.
if($i) {
return "i equals {$i}";
}
return 'i is unknown';
but the point was if I had to check for multiples to match something, then do something else, that's how I would do it... albeit this is a simple case with a better solution.
gremlinsinc|3 years ago
Ymmv, but match is a great code saver, and is very nice for enums and methods on enums.
Before match i'd probably do something like:
Not really, I'd probably do.. but the point was if I had to check for multiples to match something, then do something else, that's how I would do it... albeit this is a simple case with a better solution.