note 62145 added to function.ldap-get-entries

From: Date: Tue, 21 Feb 2006 08:20:28 +0000
Subject: note 62145 added to function.ldap-get-entries
Groups: php.notes 
Request: Send a blank email to php-notes+get-104109@lists.php.net to get a copy of this message
When you like to get the entry from LDAP in the same style as ldap_add(), then you can use the following function to convert this entry. <?php /** * Take an LDAP and make an associative array from it. * * This function takes an LDAP entry in the ldap_get_entries() style and * converts it to an associative array like ldap_add() needs. * * @param array $entry is the entry that should be converted. * * @return array is the converted entry. */ function cleanUpEntry( $entry ) { $retEntry = array(); for ( $i = 0; $i < $entry['count']; $i++ ) { $attribute = $entry[$i]; if ( $entry[$attribute]['count'] == 1 ) { $retEntry[$attribute] = $entry[$attribute][0]; } else { for ( $j = 0; $j < $entry[$attribute]['count']; $j++ ) { $retEntry[$attribute][] = $entry[$attribute][$j]; } } } return $retEntry; } ?> ---- Server IP: 217.160.72.57 Probable Submitter: 84.114.180.113 (proxied: 127.0.0.1) ---- Manual Page -- http://www.php.net/manual/en/function.ldap-get-entries.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62145 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62145&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62145&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104109) next »