rhyspaterson Posted December 6, 2007 Share Posted December 6, 2007 Hey guys, I'm pulling some variables from our database using ODBC and all is fine. However, with two of my variables, i am getting a whole lot of white space at the end of them. This wasn't noticeable until i wrote the variables to my XML file as seen below: <marker lat="111.11111111" lng="111.1111111" country="AU" city="Perth" company="Bob's High School " ipAddress="203.14.53.46 " registrationID="10008" /> I have changed the lat/long and company name for security But! As you can see, at the end of the company and ipAddress there is a large amount of white space. This only happens with these two variables. It hasn't got anything to do with the way i am writing them to the XML file as looking at the variables themselves yields the same results. So i'm looking for a way or removing this white space. Maybe searching for the ending " and then going backwards until the ending letter, and deleting everything in between.. i'm not too sure where to go with this one. Thanks for your help! Quote Link to comment Share on other sites More sharing options...
sasa Posted December 6, 2007 Share Posted December 6, 2007 look trim() function Quote Link to comment Share on other sites More sharing options...
rhyspaterson Posted December 6, 2007 Author Share Posted December 6, 2007 Cheers, $variable = trim($variable , " \t\r"); ^^^^ worked a treat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.