I need help optimizing the code to run faster, unless it is optimized the best.
I also want to alphabetize the list and I am unsure how to do that.
It should be alphabetized by $userinfo[0]["sn"][0]
I am using the adLDAP class: http://adldap.sourceforge.net/
<?php
require_once('adLDAP.php');
//header('Content-type: text/json');
$adldap = new adLDAP();
$groupMembers = $adldap->group_members('STAFF');
//print_r($groupMembers);
$userinfo = $adldap->user_info($username, array("givenname","sn","telephonenumber"));
$displayname = $userinfo[0]["givenname"][0]." ".$userinfo[0]["sn"][0];
print "<ul>";
foreach ($groupMembers as $i => $username) {
$userinfo = $adldap->user_info($username, array("*"));
$displayname = "<strong>".$userinfo[0]["givenname"][0]." ".$userinfo[0]["sn"][0]."</strong> - ".$userinfo[0]["telephonenumber"][0];
if($userinfo[0]["sn"][0] != "" && $userinfo[0]["givenname"][0] != "" && $userinfo[0]["telephonenumber"][0] != "") {
print "<li>".$displayname."</li>";
}
}
print "</ul>";
?>