|
-
Apr 25th, 2002, 01:15 PM
#1
Thread Starter
Stuck in the 80s
Replace??
I have this code:
PHP Code:
$fcode = str_replace(" ( ", "(", $fcode);
$fcode = str_replace(" ) ", ")", $fcode);
$fcode = str_replace(" . ", ".", $fcode);
$fcode = str_replace(" ' ", "'", $fcode);
$fcode = str_replace(" , ", ",", $fcode);
I don't think str_replace accepts multi-deliminators, but what about others like preg_replace, or ereg_replace? Do any of these do this? And what would the syntax look like?
I'm looking for soemthing like:
$fcode = _replace(" ( \ ) \ . \ ' \ , \", "(\)\.\'\,\", $fcode);
Is there anything like this?
-
Apr 25th, 2002, 02:43 PM
#2
Fanatic Member
this is from php.net
preg_replace vs. str_replace.
str_replace is about 25% faster on a single match in a short string, and
gets increasingly faster as the number of matches increases. (It hits 38%
on the second match...) Whole-script times for 10000 matches in a loop
only showed 14% differences in runtime: if you're running a script that
does ONE match as a test, you'll see absolutely no difference in runtime
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 26th, 2002, 10:41 AM
#3
Thread Starter
Stuck in the 80s
I don't think that helps me...
-
Apr 29th, 2002, 05:18 PM
#4
leave it like you have it.
-
Apr 30th, 2002, 05:59 AM
#5
Fanatic Member
thats what i was going for
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 30th, 2002, 12:56 PM
#6
Thread Starter
Stuck in the 80s
Ah, I gotcha now. I just thought there might have been a way to do it without so many lines.
Thanks for the assistance.
-
Apr 30th, 2002, 02:50 PM
#7
Fanatic Member
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|