Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Step and append an integer to an id snippet
<?php
// Initialize a counter
$count = 1;
foreach ($project_managers as $key => $value) {
// Create the id for each individual checkbox - stepping +1 on each iteration
$check_id = "customCheck" . $count;
echo '<li class="custom-control custom-checkbox">
<input id="' . $key . '" name=' . $value . ' type="checkbox" class="custom-control-input your-checkbox" checked>
<label class="custom-control-label" for="' . $key . '">' . $value . '</label></li>';
// Progress the counter +1 after the checkbox is output
$count += 1;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.