I am parsing the results of an ldap call to an active directory. I am trying to get all users in a security group. Here are my results:
$res = [member] => Array
(
[count] => 2
[0] => CN=User 1,OU=SomeOU,DC=someDC,DC= someDC2
[1] => CN=User 2,OU=SomeOU,DC= someDC,DC= someDC2
)
Is there a cleaner way to get the name of out the results? (i.e. User 1,User 2)
foreach ($res['member'] as $k => $v){
$exp = explode("=",$v);
$exp = explode(",",$exp[1]);
$name = $exp[0];
echo $name."
";
}