fputs linefeed
Combinations of chr(10) and chr(13) have unpredictable outputs
If you want to collect data from a text file with fgets, lines should be seperated by \r\n or in hex 0D 0A.
Unfortunately you do not get what you might expect using fputs. Using PHP 5.6.3. and Windows 10.
fputs | PHP 5.6.3. output | PHP 4.3.2. output write | PHP 4.3.2. output append |
---|---|---|---|
\r | \r\n | \r | \r\n |
\n | \r\n | \r | \r\n |
\n\r | \r\n\r\n | \r\n | \r\n\r |
\r\n | \r\n | \r\r | \r\r\n |
\n\n | \r\n\r\n | \r\n | \r\n\r\n |
\r\r | \r\n\r\n | not tested | not tested |