PHP Enum and Match expression are readable, reusable, and clean syntax.
<?php
enum Operation
{
case Increment;
case Decrement;
}
$result = match($op) {
Operation::Increment => $value + 1,
Operation::Decrement => $value - 1,
};
#PHP8 #enum #match #phptips