On Sat, 2010-06-19 at 10:09 +0100, Ashley Sheridan wrote: > On Fri, 2010-06-18 at 15:03 -0500, Adam 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? > > > > > A substring() a strpos() should do the trick: > > substring($entries[$i]['dn'], 0, strpos($entries[$i]['dn']-1)) > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > An amendment, as I read the rest of the thread and realised that I too had missed out a check for the comma: substring($entries[$i]['dn'], 0, (strpos($entries[$i]['dn']?strpos($entries[$i]['dn']-1:strlen($entries[$i]['dn'])))) It doesn't look pretty, but it should do the trick. Thanks, Ash http://www.ashleysheridan.co.uk