Reputation: 99
Here i am using PHP 5.6 version in that i am trying to do line break but it is not happening , i having text like Gshdhdhhdhdhhdhdhd\nGdghdhdhhdhd\nGdgdhfhhdhd\nGgdhdhhdd\nGgdhdhdhhd\nGe hdhdhdhd
using this text \n
means new line should start ,so i am using str_replace
but it not working
My Code
echo str_replace ('\r\n','<br>','Gshdhdhhdhdhhdhdhd\nGdghdhdhhdhd\nGdgdhfhhdhd\nGgdhdhhdd\nGgdhdhdhhd\nGe hdhdhdhd');
Another method
echo nl2br ("Gshdhdhhdhdhhdhdhd\nGdghdhdhhdhd\nGdgdhfhhdhd\nGgdhdhhdd\nGgdhdhdhhd\nGe hdhdhdhd");
Upvotes: 0
Views: 133
Reputation: 79
If you are outputting this on an html page use the break tag
I do this all the time in my test suites for debugging.
echo "Some text want a newline<br>next text want another newline<br>";
the \n and \r\n are for text files.
Upvotes: 0