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 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); 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. 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. Link to comment https://forums.phpfreaks.com/topic/199252-str_replace-problem/#findComment-1045776 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.