Optimize existing code and need to list alphabetically.

Posted by Brad on Stack Overflow See other posts from Stack Overflow or by Brad
Published on 2010-04-06T21:53:45Z Indexed on 2010/04/06 22:33 UTC
Read the original article Hit count: 408

Filed under:
|

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>";
?>

© Stack Overflow or respective owner

Related posts about ldap

Related posts about php