Someone give me a hand ? Easy PHP snippet needed !

IntensE

Power Member
Joined
Aug 19, 2008
Messages
771
Reaction score
661
Hey guys I need a php thing to be done for me, or if you have other suggestions I would highly appreciate.

Basically I have a txt file with a lot of rows (100) like this:

this is a random text on line 1 with a $keyword thats awesome.
this is another random text on line 2 with $keyword2 thats super cool.
this is a boring text on line 3 with $keyword3 thats boring.
.....
bla bla bla $keyword100 blabla.

Now I need to change everytime the keywords, to other ones. And you can imagine by going find-replace one by one it's taking A LOT of time.

I would love if someone would help me to make a small php script that will have a text form where I enter all the 100 keywords (1 per line) and it will change them in the whole text file.

So, if I enter:
apple
mouse
...

the output would be:
this is a random text on line 1 with a APPLE thats awesome.
this is another random text on line 2 with MOUSE thats super cool.

Hope I explained well.

If there is another way to do this, please tell me !
 
No problem. Let me know exactly how u want it done. will do it tomoro morning in office.
 
Ok , We are php / mysql expert and provide you easy to use admin panel for manage your page to update the text easily and quickly by using editor also ....
 
Guys, I don't want to hire someone, guess it's my bad I should've mentioned it in the title. All I am asking is if someone know an easy solution to replace all words like that, or if anyone can point me to the "php way".
 
Guys, I don't want to hire someone, guess it's my bad I should've mentioned it in the title. All I am asking is if someone know an easy solution to replace all words like that, or if anyone can point me to the "php way".

Naah i dint ask for money lol. i thought its easy job and i wud be glad u help u in my free time. that's all
 
Hello good sir, try this. I just whipped it up quickly. If I understood your problem correctly, this should work.

http://hastebin.com/xapakesesu.mel
That is assuming that $keyword,$keyword1 etc. were actual keywords, not literally there.
However, if your original strings actually contained '$keyword1' etc, this script will do the trick:

http://hastebin.com/mogehisuti.php

It doesn't have a web interface, but works on text files.
 
Last edited:
Thanks karkade, exactly what I needed, works perfectly !
 
Back
Top