PHP: Telegram Bot: Insert line break to text message



PHP Snippet 1:

$txt = urlencode("here is my text.\n and this is a new line \n another new line");

PHP Snippet 2:

$text = 'test 123
         another text';

PHP Snippet 3:

$text = 'text 123 '.PHP_EOL.'yet another text';

PHP Snippet 4:

$text = 'text 123 '.chr(10).'yet another text';

PHP Snippet 5:

$telegramMessage = 
        "<strong>Reservation Request</strong>\n".
         '<strong>Name:</strong> ' . $reservation->reserv_name . "\n".
         '<strong>E-mail:</strong> <a href="mailto:' . $reservation->email . '"> ' . $reservation->email . "</a>\n".
         '<strong>Phone:</strong> ' . $reservation->phone . "\n".
         '<strong>Reservation Date/Time:</strong> ' . $reservation->reserv_date_time->format('d-m-Y H:i') . "\n".
         '<strong>Number of people:</strong> ' . $reservation->number_of_people . "\n".
         '<strong>Message:</strong> ' . $reservation->reserv_message . "\n";

Telegram::sendMessage([
            'chat_id' => env('TELEGRAM_CHAT_ID', ''),
            'parse_mode' => 'HTML',
            'text' => $telegramMessage,
        ]);

PHP Snippet 6:

$txt = implode("\n", explode('\n', $txt));

PHP Snippet 7:

... sendMessage?parse_mode=HTML&text="... paragraph1<pre>\n</pre>paragraph2 ..."

PHP Snippet 8:

$text = curl_escape($handle, $text);

PHP Snippet 9:

       hello\neverybody 

PHP Snippet 10:

       hello
       everybody

PHP Snippet 11:

      $my_msg = str_replace("\\n","\n",$my_msg);

PHP Snippet 12:

$txt = "Thanks for joining, Every day at </br> almost 18:30 GMT an intersting video will be sent";

PHP Snippet 13:

$txt = "Thanks for joining, Every day \r\n at almost 18:30 GMT an intersting video will be sent";

PHP Snippet 14:

$txt = 'aaaaaaaaa\nnew line1 \nnewline2';
$parameters = array('chat_id' => $chatId, "text" => $txt);

$parameters["method"] = "sendMessage";
echo json_encode($parameters);

PHP Snippet 15:

$text ="sth sth
sth sth";
$text = urlencode($text);

PHP Snippet 16:

$message='Hi'
$message=$message."\n";
$message=$message.'Guys'

PHP Snippet 17:

$text = "exampletest \n example"

PHP Snippet 18:

$text1 = 'example';
$text2 = 'next';
$data = $text1 . "\n" . $text2;