PHP 8.5.0 Beta 1 available for testing

Voting

: zero plus eight?
(Example: nine)

The Note You're Voting On

emepese
7 years ago
Probably not the best way but for those who are looking for a way to get de CN of a DN without the "cn=" part this is a function with a regex pattern:

<?php
function getCNofDN($dn) {
$return=preg_match('/[^cn=]([^,]*)/i',$dn,$dn);
return(
$dn[0]);
}

echo
getCNofDN("cn=emepese,cn=someLevel,dc=someCompany");

// Will print "emepese"

?>

<< Back to user notes page

To Top