$matched = preg_match('/([^\r\n]*)\r?\n(.*)/s', $str, $m_r); if($matched) { $all = $m_r[0]; $first_line = $m_r[1]; $other_lines = $m_r[2]; }