On Fri, Jun 18, 2010 at 15:56, Adam Williams
<adam_willi...@bellsouth.net> wrote:
> I'm querying data and have results such as a variable named
> $entries[$i]["dn"]:
>
> CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92,OU=XXXXXXXXXXf,OU=XXXXXXXXXX,OU=XXXXXXXXXXXXX,DC=xxxxxxxx,DC=xxxxxxxxxx,DC=xxx
>
> Basically I need to strip off the first command everything after, so that I
> just have it display CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92.
>
> I tried echo rtrim($entries[$i]["dn"],","); but that doesn't do anything.
>  Any ideas?

    Check out substr() with strpos().

<?php
$s = 
'CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92,OU=XXXXXXXXXXf,OU=XXXXXXXXXX,OU=XXXXXXXXXXXXX,DC=xxxxxxxx,DC=xxxxxxxxxx,DC=xxx';

if (substr($s,0,strpos($s,',')) ==
'CN=NTPRTPS3-LANIER-LD335c-LH107-PPRNP9A92') {
        echo "Good.".PHP_EOL;
} else {
        echo "Bad.".PHP_EOL;
}
?>

-- 
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to