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
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