Hi
Basically what im after is a way to search a flat text file for a requested string and be able to remove the said string if its found.
IE.
Text file contents
~~~~~~~~~~~
apple
banana
cherry
If the user types banana into the form and submits it then the text file is appended to have banana removed.
Hope someone can help..
Hi can anyone help with a string searh query
Moderator: General Moderators
-
spudmclard
- Forum Newbie
- Posts: 16
- Joined: Thu Oct 27, 2005 3:06 am
Code: Select all
<?PHP
$f = Array('Apple', 'Banana', 'foo', 'bar');
$str = 'I had an apple for breakfast, a banana for lunch, followed by a foobar for dinner.';
$str = str_replace($f, '', $str);
?>