What is the 's' modifier in PHP, and how can it be used to modify the preg_match function?

The 's' modifier in PHP is used to treat the subject string as a single line, meaning the dot metacharacter in a regular expression will match newlines as well. This can be useful when you have a multi-line string and want to match patterns across multiple lines using the preg_match function. To use the 's' modifier, you simply append it to the end of your regular expression pattern. Example:

$subject = "This is a multi-line
string with
multiple lines.";
$pattern = '/multi-line.*lines/s';
if (preg_match($pattern, $subject, $matches)) {
    echo "Pattern found: " . $matches[0];
} else {
    echo "Pattern not found.";
}