Re: Text Parser

From: Date: Thu, 02 Dec 2004 15:30:08 +0000
Subject: Re: Text Parser
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203348@lists.php.net to get a copy of this message
Hello Pablo, Thursday, December 2, 2004, 3:12:09 PM, you wrote: PDM> I´m receiving this: "house , ball , door , roof , floor" PDM> And I want to obtain this: PDM> "'house','ball','door','roof','floor'" PDM> Maybe, I should use implode or explode, but I just can´t figure out how.. PDM> Help? You could explode it, loop it, etc etc - but if the data always follows that format and is trust-worthy, the following is probably quicker: $old_data = "house,ball,door,roof,floor"; $data = "'" . str_replace("," , "','" , $old_data) . "'"; At least, I can't see why this won't work :) If your data has all those extra spaces in, then just amend the str_replace accordingly. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I am not young enough to know everything." - Oscar Wilde

« previous php.general (#203348) next »