jd2007 Posted July 11, 2007 Share Posted July 11, 2007 how do i replace two words in a string at the same time ? Quote Link to comment Share on other sites More sharing options...
metrostars Posted July 11, 2007 Share Posted July 11, 2007 Using arrays and str_replace $old = array("Oldword1", "Oldword2"); $new = array("Newword1", "Newword2"); $newstring = str_replace($old, $new, $oldstring); Quote Link to comment Share on other sites More sharing options...
mosi Posted July 11, 2007 Share Posted July 11, 2007 <?php $original_text = "this is the original text"; $original_text = str_replace("original", "new", $original_text); echo $original_text; // Will echo "this is the new text" ?> Look at: http://www.php.net/str_replace for more information Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 11, 2007 Author Share Posted July 11, 2007 metrostars, thanks...u gave me the right answer ! Quote Link to comment 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.