$stmt = $mysqli->prepare("SELECT * FROM comments WHERE id IN (" . $question_marks . ") ORDER BY id DESC");
$stmt->bind_param($types, $params);
$stmt->execute();
$types - это "iiii"
$params - это [1, 3, 4, 6]
$question_marks - это "?,?,?,?"
$params = [1, 3, 4, 6];
$clause = implode(',', array_fill(0, count($params), '?'));
$types = str_repeat('i', count($params));
$stmt = $mysqli->prepare("SELECT * FROM comments WHERE id IN ($clause)");
$stmt->bind_param($types, ...$params);
$stmt->execute();
$resArr = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
if(!$resArr) exit('No rows');
var_export($resArr);
$stmt->close();