What are the implications of not escaping slashes correctly in regular expressions when using preg_match in PHP?

If slashes are not escaped correctly in regular expressions when using preg_match in PHP, it can lead to syntax errors or unexpected behavior in the matching process. To solve this issue, any forward slashes (/) within the regular expression pattern should be escaped with a backslash (\) to ensure they are treated as literal characters.

$pattern = '/example\.com/';
$string = 'Visit example.com for more information';

if (preg_match($pattern, $string)) {
    echo 'Match found!';
} else {
    echo 'No match found';
}