A php variable contains the following string:
text
text2
- item1
- item2
You have to wrap \n or \r in "", not ''. When using single quotes escape sequences will not be interpreted (except \' and \\).
The manual states:
If the string is enclosed in double-quotes ("), PHP will interpret more escape sequences for special characters:
\n linefeed (LF or 0x0A (10) in ASCII)
\r carriage return (CR or 0x0D (13) in ASCII)\
(...)