Published 5 months ago.Last updated September 28th, 2018 foreach(preg_split("/((\r?\n)|(\r\n?))/", $subject) as $line){ // do stuff with $line }