squiblo Posted April 21, 2010 Share Posted April 21, 2010 the following does not work $old = "*(#01)*"; $new = "\"; $message = str_replace($old, $new, $message); thanks Quote Link to comment https://forums.phpfreaks.com/topic/199252-str_replace-problem/ Share on other sites More sharing options...
oni-kun Posted April 21, 2010 Share Posted April 21, 2010 You're escaping the quote, It shouldn't even run. Try: $old = "*(#01)*"; $new = "\\"; $message = str_replace($old, $new, $message); Quote Link to comment https://forums.phpfreaks.com/topic/199252-str_replace-problem/#findComment-1045771 Share on other sites More sharing options...
aebstract Posted April 21, 2010 Share Posted April 21, 2010 the following does not work $old = "*(#01)*"; $new = "\"; $message = str_replace($old, $new, $message); thanks Here is the logic of it: str_replace("replace this", "with this", "in this string"); $message shouldn't be in your str_replace. I'm not sure what you're trying to do though. Quote Link to comment https://forums.phpfreaks.com/topic/199252-str_replace-problem/#findComment-1045772 Share on other sites More sharing options...
oni-kun Posted April 21, 2010 Share Posted April 21, 2010 aebstract, He is simply assigning the result of the str_replace function to itself, thus no need for a temporary variable. Quote Link to comment https://forums.phpfreaks.com/topic/199252-str_replace-problem/#findComment-1045776 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.