Subscribe to PHP Freaks RSS

PHP 8.0 feature focus: <span>match() expressions</span>

syndicated from planet-php.net on September 23, 2020

In our last episode, we discussed coming improvements to PHP’s type system. Today we look at a new construct that makes branching logic more powerful. PHP has had a switch statement since the dawn of time, modeled on the same construct in C. You’ve surely seen it before: <?php switch ($var) { case 'a': $message = "The variable was a."; break; case 'b': $message = "The variable was c."; break; case 'c': $message = "The variable was c.