3 Adding escaping of untrusted user input, formatting to WP coding standards to improve readability
source | link

There may be some different way to do that, but most proper way to do that is following.

    <?php
        
$args = array(
     'role'   'role' => 'Your desired role goes here.',
        'orderby' => 'user_nicename',
      'order'  'order' => 'ASC'
      );
       $users = get_users( $args );
         
echo '<ul>';
         foreach ( $users as $user ) {
          echo '<li>' . esc_html( $user->display_name ) . '[' . esc_html( $user->user_email ) . ']</li>';
         }
        echo '</ul>';
     
?>

There may be some different way to do that, but most proper way to do that is following.

    <?php
       $args = array(
        'role' => 'Your desired role goes here.',
        'orderby' => 'user_nicename',
        'order' => 'ASC'
      );
       $users = get_users($args);
        echo '<ul>';
         foreach ($users as $user) {
          echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
         }
        echo '</ul>';
    ?>

There may be some different way to do that, but most proper way to do that is following.

<?php
 
$args = array(
    'role'    => 'Your desired role goes here.',
    'orderby' => 'user_nicename',
    'order'   => 'ASC'
);
$users = get_users( $args );
 
echo '<ul>';
foreach ( $users as $user ) {
    echo '<li>' . esc_html( $user->display_name ) . '[' . esc_html( $user->user_email ) . ']</li>';
}
echo '</ul>';
 
?>
2 improved formatting
source | link

There may be some different way to do that, but most proper way to do that is following.

    <?php
       $args = array(
        'role' => 'Your desired role goes here.',
        'orderby' => 'user_nicename',
        'order' => 'ASC'
      );
       $users = get_users($args);
        echo '<ul>';
         foreach ($users as $user) {
          echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
         }
        echo '</ul>';
    ?>

There may be some different way to do that, but most proper way to do that is following.

    <?php
$args = array(
 'role' => 'Your desired role goes here.',
 'orderby' => 'user_nicename',
 'order' => 'ASC'
);
 $users = get_users($args);
echo '<ul>';
 foreach ($users as $user) {
 echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
 }
echo '</ul>';
?>

There may be some different way to do that, but most proper way to do that is following.

    <?php
       $args = array(
        'role' => 'Your desired role goes here.',
        'orderby' => 'user_nicename',
        'order' => 'ASC'
      );
       $users = get_users($args);
        echo '<ul>';
         foreach ($users as $user) {
          echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
         }
        echo '</ul>';
    ?>
1
source | link

There may be some different way to do that, but most proper way to do that is following.

    <?php
$args = array(
 'role' => 'Your desired role goes here.',
 'orderby' => 'user_nicename',
 'order' => 'ASC'
);
 $users = get_users($args);
echo '<ul>';
 foreach ($users as $user) {
 echo '<li>' . $user->display_name.'['.$user->user_email . ']</li>';
 }
echo '</ul>';
?>