note 14271 added to function.ldap-dn2ufn.php

From: Date: Tue, 24 Jul 2001 20:47:45 +0000
Subject: note 14271 added to function.ldap-dn2ufn.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15789@lists.php.net to get a copy of this message
function ldap_unf2dn($unf,$delimeter=".") { $seperated = explode($delimeter,$unf); //split the unf up by the given delimeter $LastKey=count($seperated)-1; //0 is the first key to total-1 would be the last key foreach($seperated as $key => $value) { if ($key == 1) { //first variable is the CN $dn="${dn}cn=$value,"; } elseif ($key == $LastKey) { //last variable, so it's the O $dn="${dn}o=$value"; } elseif ($value == "") { //value is blank, so continue continue; } else { //just a typical OU $dn="${dn}ou=$value,"; } }; return $dn; } $unf=".bryan.users.admin.apachetoolbox"; $dn=ldap_unf2dn($unf); print "$dn" // will give me "cn=bryan,ou=users,ou=TS,o=apachetoolbox" http://www.php.net/manual/en/function.ldap-dn2ufn.php

« previous php.notes (#15789) next »