What are the potential pitfalls of using incorrect modifiers in preg_match in PHP?

Using incorrect modifiers in preg_match can lead to unexpected results or errors in your regular expression matching. To solve this issue, make sure to use appropriate modifiers such as 'i' for case-insensitive matching or 's' for treating the input as a single line.

// Example of using correct modifiers in preg_match
$string = "Hello World";
$pattern = "/hello/i"; // using 'i' modifier for case-insensitive matching
if (preg_match($pattern, $string)) {
    echo "Match found!";
} else {
    echo "No match found.";
}