Description
Returns the number of users for each role, along with the total number of users on the site.
Usage
<?php count_users( $strategy ); ?>
Parameters
$strategy
(string) (optional) Either 'time' or 'memory'. In most cases, the default value 'time' is the best choice in the current implementation.
Default: 'time'
Return value
array
Contains the total number of users and an array holding the user count for each role.
Example
Default usage
A call to count_users() returns the number of users in each role. Roles with no users are not included, so the result can be used directly in a foreach loop.
<?php
$result = count_users();
echo '共有 ', $result['total_users'], ' 个用户';
foreach($result['avail_roles'] as $role => $count)
echo ', ', $count, ' 是 ', $role, 's';
echo '.';
?>
For example: there are 199 users in total, including 11 administrators and 4 contributors.
