I am using wordpress and am trying to create a dropdown list of users as a metabox within a custom post type.
I have been able to create the dropdown list as follows:
<?php
$users = get_users();
// Array of WP_User objects.
foreach ( $users as $user ) {
echo '<option value="select" >' . esc_html( $user->display_name ) . '</option>';
}
?>
However, the value needs to have an incremental number for each result, i.e. select-1, select-2, select-3 - how can I add this to my results?