Re: Slight cleaning of code needed in str_replace command.

From: Date: Sat, 21 Feb 2004 16:42:01 +0000
Subject: Re: Slight cleaning of code needed in str_replace command.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-178449@lists.php.net to get a copy of this message
On Sunday 22 February 2004 00:23, Dave G wrote: > It's not as if I haven't experimented with different settings, but they > haven't been successful. By "settings" one usually means something which alters behaviour, as such str_replace() does not have any "settings". > In any case, rocket science or not, I was actually looking for advice > that might help me understand the logic behind the command better. It simply does a straight replacement: replace A with B in string C > I can't see anything syntactically wrong with the string I have put > forward, so my current assumption is that there is something I don't > understand about how the string input going into the command is parsed > (it comes from a MySQL query), or about how the command interprets line > breaks. var_dump() every variable of importance and check that they are what you expect them to be. You might want to wrap the output in some <pre> tags so the browser doesn't eat up your "\n"'s. > Perhaps someone could offer something a little more concrete than > essentially recommending I just 'try different stuff'. Anything more concrete would probably mean writing the code for you, that would be too easy (for you!). Here's another tip: start with a small test string (forget about grabbing stuff from the db), do a simple replacement, check your results, make the string more complex, repeat. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* "It takes all sorts of in & out-door schooling to get adapted to my kind of fooling" - R. Frost */

« previous php.general (#178449) next »