How can the positioning of dynamically generated checkbox labels be controlled in PHP?

When dynamically generating checkbox labels in PHP, the positioning of these labels can be controlled by using CSS to style the labels. By setting the display property of the labels to inline-block or block, you can control whether the labels appear inline with the checkboxes or on a new line. Additionally, you can use margin or padding properties to adjust the spacing between the checkboxes and their labels.

<?php
$checkboxes = array("Option 1", "Option 2", "Option 3");

foreach ($checkboxes as $checkbox) {
    echo '<input type="checkbox" id="' . $checkbox . '" name="' . $checkbox . '">';
    echo '<label for="' . $checkbox . '" style="display: inline-block; margin-right: 10px;">' . $checkbox . '</label>';
    echo '<br>';
}
?>