What PHP functions can be used to check for specific patterns in a string within a switch-case statement?

To check for specific patterns in a string within a switch-case statement in PHP, you can use functions like `preg_match()` or `strpos()` to search for patterns or substrings. These functions can be used within each case to determine if the string matches the desired pattern.

$string = "Hello World";

switch(true) {
    case preg_match('/Hello/', $string):
        echo "String contains 'Hello'";
        break;
    case strpos($string, 'World') !== false:
        echo "String contains 'World'";
        break;
    default:
        echo "String does not match any pattern";
}