I was wondering if I need to use \"break\" in \"switch\" function when \"return\" is used.
function test($string) { switch($string) { case \'test1\':
Starting with PHP 8 (Nov 2020), you can use match:
'Test 1: ', 'test2' => 'Test 2: ' } . $string; }
Although in this case you could just use an array:
'Test 1: ', 'test2' => 'Test 2: ' ][$string] . $string; }
https://php.net/control-structures.match