How can the explode() function in PHP be used to split a string into an array based on line breaks?

To split a string into an array based on line breaks in PHP, you can use the explode() function with the "\n" delimiter. This delimiter represents a line break in PHP. By using explode() with "\n", you can easily separate the string into an array where each element corresponds to a line of text.

$string = "Line 1\nLine 2\nLine 3";
$lines = explode("\n", $string);

print_r($lines);