Are preg_match functions more performant than strpos, strrpos, or strrchr functions in PHP?

Using preg_match functions in PHP can be more performant than strpos, strrpos, or strrchr functions when dealing with more complex patterns or regular expressions. This is because preg_match allows for more flexibility in pattern matching and can handle a wider range of scenarios. However, for simple string searches, strpos, strrpos, or strrchr functions may be more efficient.

// Example of using preg_match function for pattern matching
$string = "Hello, World!";
$pattern = "/Hello/";
if (preg_match($pattern, $string)) {
    echo "Pattern found in string.";
} else {
    echo "Pattern not found in string.";
}