Jump to content

Recommended Posts

[!--quoteo(post=358988:date=Mar 27 2006, 02:05 PM:name=Essjay_d12)--][div class=\'quotetop\']QUOTE(Essjay_d12 @ Mar 27 2006, 02:05 PM) [snapback]358988[/snapback][/div][div class=\'quotemain\'][!--quotec--]
i need to directly change a string $string to $string2

but whenever there is a , in $string it needs to change it to a % in $string2

thanks

d
[/quote]

you could try:
[code]$string2 = eregi_replace( ",", "%", $string1);[/code]
Why not use the [a href=\"http://www.php.net/str_replace\" target=\"_blank\"]str_replace[/a]() function, since it doesn't have the overhead of using regular expressions.
[code]<?php $string2 = str_replace( ',', '%', $string1); ?>[/code]

Ken
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.