Member Avatar for chudapati09
$info = ldap_get_entries($ldap, $search);
   
   for($i = 0; $i < count($info) - 1; $i++)
   {  
      $people =  
         array(
            $i => array(
                  'first' => $info[$i]['givenname'][0],
                  'middle' => $info[$i]['initials'][0],
                  'last' => $info[$i]['sn'][0],
                  'email' => $info[$i]['mail'][0],
                  'username' => $info[$i]['uid'][0]
               )
         );
   }

I have the following code working, but what happens is that the last entry in $info is only entered into $people. What am I doing wrong?

Member Avatar for chudapati09

Nevermind, I figured it out.

$info = ldap_get_entries($ldap, $search);
   
   for($i = 0; $i < count($info) - 1; $i++)
   {  
      $people[$i] =  
         array(
            'first' => $info[$i]['givenname'][0],
            'middle' => $info[$i]['initials'][0],
            'last' => $info[$i]['sn'][0],
            'email' => $info[$i]['mail'][0],
            'username' => $info[$i]['uid'][0]
         );
   }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.