-1
I have the following code that picks up data from the server via ldap
, where the $info
returns me an array ,I’m trying to sort alphabetically using the function sort
but unsuccessfully ,when I print my table it remains out of order.
$result_search = ldap_search($ds, $ldap_base_dn, $search_filter, $attributes);
if ($result_search) {
$info = ldap_get_entries($ds, $result_search);
$retorno = ldap_count_entries($ds, $result_search);
$tabela = '<div id ="scrollbar">';
$tabela .= '<table id="myTable">';
$tabela .= '<thead>';
$tabela .= '<tr>';
$tabela .= '<th>Nome</th>';
$tabela .= '<th>Telefone</th>';
$tabela .= '</tr>';
$tabela .= '</thead>';
$tabela .= '<tbody>';
foreach ($info as $key) {
sort($info);
if ( isset($key ['displayname'] [0] ) &&isset($key['telephonenumber'] [0] )){
$tabela .= '<tr>';
$tabela .= '<td>'.$key ['displayname'] [0].'</td>';
$tabela .= '<td>'.$key ['telephonenumber'] [0].'</td>';
$tabela .= '</tr>';}
the
sort
is before theforeach
! but also the code is withusort
– novic
It was fitting now with the example of
array
.– novic
Thanks for your attention and help @NOVIC
– KALIBBAN