Hi, I appreciate the help. I did try this code,but now I'm getting "I bought a dog and a dog." I am sorry I am such novice on this and the problem I am having is what you described, which is having it continue from where the previous replacement happened. It's not working. Here is how I test my program, on the submit form, I select 2 nouns, I enter the nouns cat and dog where I enter the nouns. Then at the bottom I type in the initial sentence of "I bought a NOUN and a NOUN." Then I click submit. What I want the PHP code to do is replace each instance of NOUN with a different noun from the list(cat or dog). I want the final sentence to look like this: "I bought a cat and a dog." Any other help would greatly be appreciated. Thanks. Oh, and one more thing I forgot to mention, my initial sentence is exploded (sentArray) into an array and the nouns the user enters are exploded into an array(nounArray). Thanks.