note 125083 added to function.ldap-get-entries

From: Date: Fri, 05 Jun 2020 07:52:27 +0000
Subject: note 125083 added to function.ldap-get-entries
Groups: php.notes 
Request: Send a blank email to php-notes+get-214724@lists.php.net to get a copy of this message
public function entriesToArray($entries=array()) { $list = array(); for($i=0;$i<$entries['count'];$i++) { $row = array(); $dn = $entries[$i]['dn']; unset($entries[$i]['count']); unset($entries[$i]['dn']); foreach($entries[$i] as $key=>$value) { if (is_int($key)) {continue;} $list_in_col = array(); foreach($value as $key2=>$value2) { if (!is_int($key2)) {continue;} $list_in_col[] = $value2; } $row[$key] = $list_in_col; } $row['dn'] = $dn; $list[$i] = $row; } return $list; } /* Format ldap entries to better array array (size=2) 'count' => int 1 0 => array (size=14) 'ou' => array (size=2) 'count' => int 1 0 => string '03024' (length=5) 0 => string 'ou' (length=2) 'mail' => array (size=2) 'count' => int 1 0 => string 'name.surname@myfirm.cz' (length=22) 1 => string 'mail' (length=4) 'telephonenumber' => array (size=2) 'count' => int 1 0 => string '+420123456781' (length=13) 2 => string 'telephonenumber' (length=15) 'personaltitle' => array (size=2) 'count' => int 1 0 => string 'Ing.|' (length=4) 3 => string 'personaltitle' (length=13) 'sn' => array (size=2) 'count' => int 1 0 => string 'MySurname' (length=6) 4 => string 'sn' (length=2) 'givenname' => array (size=2) 'count' => int 1 0 => string 'MyName' (length=5) 5 => string 'givenname' (length=9) 'count' => int 6 'dn' => string 'cn=mynickid,ou=users,o=mydepartmentid' (length=24) array (size=1) 0 => array (size=7) 'ou' => array (size=1) 0 => string '03024' (length=5) 'mail' => array (size=1) 0 => string 'name.surname@myfirm.cz' (length=22) 'telephonenumber' => array (size=1) 0 => string '+420123456781' (length=13) 'personaltitle' => array (size=1) 0 => string 'Ing.|' (length=4) 'sn' => array (size=1) 0 => string 'MySurname' (length=6) 'givenname' => array (size=1) 0 => string 'MyName' (length=5) 'dn' => string 'cn=mynickid,ou=users,o=mydepartmentid' (length=24) */ ---- Server IP: 45.112.84.4 Probable Submitter: 103.51.167.36 (proxied: 2001:718:2601:258:4dbc:3838:5a25:f2e0) ---- Manual Page -- http://php.net/manual/en/function.ldap-get-entries.php Edit -- https://master.php.net/note/edit/125083 Del: integrated -- https://master.php.net/note/delete/125083/integrated Del: useless -- https://master.php.net/note/delete/125083/useless Del: bad code -- https://master.php.net/note/delete/125083/bad+code Del: spam -- https://master.php.net/note/delete/125083/spam Del: non-english -- https://master.php.net/note/delete/125083/non-english Del: in docs -- https://master.php.net/note/delete/125083/in+docs Del: other reasons-- https://master.php.net/note/delete/125083 Reject -- https://master.php.net/note/reject/125083 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214724) next »