capcom6/android-sms-gateway

Formatting sms message

fabio323ti opened this issue ยท 2 comments

Hi, i'm try to format sms messages but any choice was in error.

for example ๐Ÿ‘

'message' => 'Hi,' . 'This is the message', (the only work)

'message' => 'Hi,' . \n 'This is the message', (error)

'message' => 'Hi,' . '\n'. 'This is the message', (error)

some way to brake line in message?

thanks

Hello,

Thank you for reaching out. There are no limitations on the characters you can use in the message field from the app's side.

To assist you better, could you please provide some additional details?

Regarding your code snippets, the second example has a syntax error because \n should be within quotes when being concatenated with the . operator.

The third example is syntactically correct, but the single quotes will not interpret \n as a newline character. In PHP, you need to use double quotes for escape sequences like newline characters to be recognized. You can also use the PHP_EOL constant, which is the correct 'End Of Line' symbol for the platform PHP is running on. You can read more about these differences on PHP's official documentation: https://www.php.net/manual/en/language.types.string.php

Here's how you could format the message with a newline:

'message' => "Hi,\nThis is the message",

Or using PHP_EOL:

'message' => "Hi," . PHP_EOL . "This is the message",

Please try the above solutions, and if you're still experiencing issues, let me know the exact error message, and I'll be happy to help further.

i'd solved formatting text inside var using shift+return on keyboards..

'message' => "Hi,
this is the message on line1
this is the message on line 2
',