- substr: documentation ( source)
- strpos: documentation ( source)
<?php
$str = "CN=van der Valk\, Marco,OU=UT,OU=NL,OU=EMEA,OU=associates,OU=usersAndGroups,DC=corporate,DC=ingrammicro,DC=com";
$CN = strpos($str, "CN=")+3;
Echo substr($str, $CN, strpos($str, '\\', $CN)-3);