gergy008 Posted August 17, 2009 Share Posted August 17, 2009 Ok. I want to put an enter in a string like this: $news_update="I have been working on games! <Enter command> There are loads more to coose from! So It comes out like this: I have been working on games! There are loads more to choose from! Instead of: I have been working on games! There are loads more to choose from! Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/170578-how-to-put-an-enter-command-in-a-string-return-help/ Share on other sites More sharing options...
Prismatic Posted August 17, 2009 Share Posted August 17, 2009 For HTML <br\> For everything else \n or \r Link to comment https://forums.phpfreaks.com/topic/170578-how-to-put-an-enter-command-in-a-string-return-help/#findComment-899712 Share on other sites More sharing options...
joel24 Posted August 17, 2009 Share Posted August 17, 2009 if the strings coming from a textbox etc play around with the nl2br function. http://us2.php.net/manual/en/function.nl2br.php Link to comment https://forums.phpfreaks.com/topic/170578-how-to-put-an-enter-command-in-a-string-return-help/#findComment-899715 Share on other sites More sharing options...
gergy008 Posted August 17, 2009 Author Share Posted August 17, 2009 For HTML <br\> For everything else \n or \r What's the difference between \n and \r? Link to comment https://forums.phpfreaks.com/topic/170578-how-to-put-an-enter-command-in-a-string-return-help/#findComment-899718 Share on other sites More sharing options...
Prismatic Posted August 17, 2009 Share Posted August 17, 2009 Er, sorry. They go together. \n is newline, \r is carriage return and moves the pointer to the start of the line. Link to comment https://forums.phpfreaks.com/topic/170578-how-to-put-an-enter-command-in-a-string-return-help/#findComment-899741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.