Need some PHP guidance

Soldato
Joined
4 Jul 2004
Posts
2,647
Location
aberdeen
Hello,
I am not asking people to do this for me, just send me in the right direction.

Basically i have a string ($mywords), and another string ($wordtoreplace).
$wordtoreplace is set up like:

word1|word2
word3|word4

basically i want it so it'll go through each word within $mywords (as mywords could be something like "example example2 another word word1"), and see if it can find that word on a line in $wordtoreplace. If it does, which using these examples, it would only find word1 on it, it then replaces word1 with the other word on that line, ie word2.

How can i search through a load of text to see if a certain word is in it, and if it is, how can i find what line that word is on within the string?

thanks
 
Hi
Ok thanks, i'll play with those. I idealy wanted to be able to have something more like
word1|word2|word3|etc
rather than just word1 and word2 on each line though.
 
Back
Top Bottom