Q:

regex split string at first line break

I would like to split a string at the first line break, instead of the first blank line 
'/^(.*?)\r?\n\r?\n(.*)/s' (first blank line)
So for instance, if I have:

$str = '2099 test\nAre you sure you
  want to continue\n some other string
  here...';

match[1] = '2099 test'
match[2] = 'Are you sure you want to continue\n some other string here...'

A:

preg_split() has a limit parameter you can take to your advantage. You could just simply do:
$lines = preg_split('/\r\n|\r|\n/', $str, 2);

A:

<?php
$str = "2099 test\nAre you sure you want to continue\n some other string here...";

$match = explode("\n",$str, 2);
print_r($match);

?>

returns
Array
(
    [0] => 2099 test
    [1] => Are you sure you want to continue
 some other string here...
)

explode's last parameter is the number of elements you want to split the string into.

