Zezombia Posted July 24, 2010 Share Posted July 24, 2010 I'm posting this from an AJAX script: <?php $file = fopen('log.txt', 'a'); fwrite($file, '\r\n' . $_GET['name'] . ': ' . $_GET['text']); fclose($file); ?> Unfortunately it literary writes \r\n instead of creating a new line. What's the proper method of doing this? Link to comment https://forums.phpfreaks.com/topic/208746-simple-question-new-line-in-text-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 24, 2010 Share Posted July 24, 2010 You need to use double-quotes around the \r\n Ref: http://www.php.net/manual/en/language.types.string.php Link to comment https://forums.phpfreaks.com/topic/208746-simple-question-new-line-in-text-file/#findComment-1090536 Share on other sites More sharing options...
wildteen88 Posted July 24, 2010 Share Posted July 24, 2010 Quote You need to use double-quotes around the \r\n Another method is to use the PHP constant PHP_EOL Link to comment https://forums.phpfreaks.com/topic/208746-simple-question-new-line-in-text-file/#findComment-1090621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.