Are regex\'s allowed in PHP switch/case statements and how to use them ?
Yes, but you should use this technique to avoid issues when the switch argument evals to false:
false
switch ($name) { case preg_match('/John.*/', $name) ? $name : !$name: // do stuff }