How to make buttons in a row for a telegram bot?

Trying to make 3кнопки in a row for telegram bot
There is a script
$countrys = DB::$the->query("SELECT * FROM `set_country` WHERE `active` = '1' ");
while ($country = $countrys->fetch()) {
$keyboard[] = [['text' => $country['name'], 'callback_data' => 'orderNumber' . $country['provider_type']]];
}
$bot->sendInlineKeyboard($id, $text, $keyboard);

Now displays 1 per row. To remove 3 buttons need to do

$keyboard[] = [['text' => $country['name'], 'callback_data' => 'orderNumber' . $country['provider_type']],['text' => $country['name'], 'callback_data' => 'orderNumber' . $country['provider_type']],['text' => $country['name'], 'callback_data' => 'orderNumber' . $country['provider_type']]];
But how to create such array can't understand
March 19th 20 at 08:24
1 answer
March 19th 20 at 08:26
Solution
keyboard takes a series of lines with buttons. It turns out that the first array is the first row of buttons and so on. And if you are in one of the rows of buttons to specify 2 buttons, they stretch across the width of the body of the messenger at 50% width. Or if you put in a row of 4 buttons, they will be 25%
$keyboard = [];

$1stButtonsLine = ['Once', 'Two', 'Three'];
$2ndButtonsLine = ['Four', 'Five', 'Six']

array_push($keyboard, $1stButtonsLine);
array_push($keyboard, $2ndButtonsLine);


this example will be 2 rows of buttons with a width of 33%

Find more questions by tags TelegramArraysPHP