This question will probably be easy but I'm having an issue sorting a multi-dimensional array.
I have pulled all the users in a specific OU from ldap and stored them in an array called $info:
$filter = "(objectClass=user)";
$justthese = array(
"whenCreated",
"cn",
"title",
"userAccountControl",
"accountExpires",
"sAMAccountName"
);
$sr = ldap_search($ldap_conn, $basedn, $filter, $justthese);
$info = ldap_get_entries($ldap_conn, $sr);
So then I do a foreach on $info and display the users in a table and stuff.
I want to know, once I have $info, how would I sort this array via the "whenCreated" attribute of each entry?
So, for example, I might have:
Info[0] =
array{
"whenCreated" = 03122015,
"cn" = John Smith
etc
}
and
Info[1] =
array{
"whenCreated" = 01122015,
"cn" = Jane Smith
etc.
}
So, on sorting the array, I'd want $info[1] to precede info[0] because the whencreated attribute in that array is first.
Thanks
EDIT: Re-opening as answer was simple and not covered in that thread.