preg_split
the variable containing the text, and iterate over the returned array:
foreach(preg_split("/((\r?\n)|(\r\n?))/", $subject) as $line){
// do stuff with $line
}
More Related Contents:
- How do I check if a string contains a specific word?
- Split a comma-delimited string into an array?
- startsWith() and endsWith() functions in PHP
- PHP – concatenate or directly insert variables in string
- Why does PHP consider 0 to be equal to a string?
- Passing base64 encoded strings in URL
- Replacing accented characters php
- How to remove accents and turn letters into “plain” ASCII characters? [duplicate]
- Capturing text between square brackets in PHP
- Convert a comma-delimited string into array of integers?
- Replace last occurrence of a string in a string
- How to get everything after a certain character?
- Get first 100 characters from string, respecting full words
- PHP remove special character from string
- Remove a string from the beginning of a string
- What is the most efficient way to count all the occurrences of a specific character in a PHP string?
- Title case a string containing one or more last names while handling names with apostrophes
- Php – regular expression to check if the string has chinese chars
- How can I remove part of a string in PHP? [closed]
- Merge array items into string
- PHP String Manipulation: Extract hrefs
- How to convert PascalCase to snake_case?
- Get last whole number in a string
- Include constant in string without concatenating
- Remove Trailing Slash From String PHP
- Measure string size in Bytes in php
- Explode a paragraph into sentences in PHP
- Hint or partially hide email address with stars (*) in PHP
- Format 32-character string with hyphens to become UUID
- finding common prefix of array of strings