Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add line break in mobile sms

I am working with an API of a certain sms service and I just want to know how to add a line break from php code in a plain text format to mobile?

Can someone help me?

like image 682
Aldee Avatar asked Sep 28 '11 17:09

Aldee


2 Answers

I know this is an old question but anyway it might help someone.

I tend to use PHP_EOL for this purposes (due to cross-platform compatibility).

echo "line 1".PHP_EOL."line 2".PHP_EOL;

If you're planning to show the result in a browser then you have to use "<br>".

like image 77
Mahesh Singh Chouhan Avatar answered Oct 27 '22 06:10

Mahesh Singh Chouhan


$text = "This is line 1.\nThis is line 2.";

Be sure to use double quotes around the string, not single quotes.

If that's not working, you'll need to talk to the folks who made the API.

like image 44
ceejayoz Avatar answered Oct 27 '22 05:10

ceejayoz