I’ve always used this with great success:
$array = preg_split("/\r\n|\n|\r/", $string);
(updated with the final \r, thanks @LobsterMan)
More Related Contents:
- Split string by new line characters
- Remove empty array elements
- How can I get a hex dump of a string in PHP?
- Remove new lines from string and replace with one empty space
- Truncate a multibyte String to n chars
- Remove portion of a string after a certain character
- How can I replace a variable in a string with the value in PHP?
- php/mysql with multiple queries
- How do I linkify urls in a string with php?
- PHP Echo Line Breaks
- How to split a string by multiple delimiters in PHP?
- Check whether $_POST-value is empty
- How to get email address from a long string
- line breaks in a textarea
- use strings to access (potentially large) multidimensional arrays
- String contains any items in an array (case insensitive)
- Structure of a Serialized PHP string
- format xml string
- How to cast array elements to strings in PHP?
- How to reverse a Unicode string
- remove duplicate from string in PHP
- How to Convert Boolean to String
- Regex & PHP – isolate src attribute from img tag
- Delete first 3 characters and last 3 characters from String PHP
- How can I get the last 7 characters of a PHP string?
- Convert a String to Variable
- Multi-byte safe wordwrap() function for UTF-8
- How to convert all characters to their html entity equivalent using PHP
- Limit String Length
- PHP remove commas from numeric strings