Re: multiple replaces...

From: Date: Sat, 12 Jan 2002 13:50:25 +0000
Subject: Re: multiple replaces...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-80287@lists.php.net to get a copy of this message
No need to loop. str_replace() already supports arrays! check the manual. bvr. On Sat, 12 Jan 2002 12:57:10 -0000, DL Neil wrote: >Yes, I thought about that. But, what should I do when the markers are absolutely NOT in any >sequence. > >=sequence would matter if it was possible that one of the markers could replace some text and >that replacement >subsequently became the marker for a further replacement ... nightmare=recursion! > >I also thought about something like >$replace[1][1] = "!one!"; //marker >$replace[1][2] = "hehee"; //replace with >$replace[1][1] = "test"; //marker >$replace[1][2] = "foobar"; //replace with >$replace[1][1] = "repl"; //marker >$replace[1][2] = "humpty-dumpty"; //replace with >$replace[1][1] = "blah"; //marker >$replace[1][2] = "boo"; //replace with > >Now, when I would do a loop thingie that goes through all those, then it would be a pretty nice >and compact >solution... > >What about speed issues regarding this solution? > >=check out string functions. On simple stuff they will beat RegEx for speed hands down - but >watch out if >case-sensitivity is relevant. > >=dn > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#80287) next »