Author: Ilija Tovilo
First there was “If … then,” then (no pun intended) there was “switch.” There was much rejoicing as switch gave developers a format in which to offer a multitude of “if … then” scenarios without the cumbersome repetitive if … then syntax. PHP 8 brings to us “Match,” which offers defined
return values, no type coercion, no fallthrough, and exhaustiveness.
// PHP 7x
switch ($this->pants->mine['type']) {
case pants::T_SELECT:
$result = $this->SelectPants();
break;
case Pants::T_UPDATE:
$result ...