How can the preg_match_all function be modified to handle multi-line patterns effectively?

The preg_match_all function in PHP does not handle multi-line patterns effectively by default. To address this issue, the "s" modifier can be added to the regular expression pattern to make it match across multiple lines. This modifier allows the dot (.) metacharacter to match newline characters as well.

// Example code snippet
$text = "Line 1\nLine 2\nLine 3";
$pattern = '/Line \d/s';
preg_match_all($pattern, $text, $matches);
print_r($matches[0]);