Page 1 of 1

Hi can anyone help with a string searh query

Posted: Sun May 07, 2006 6:59 pm
by spudmclard
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..

Posted: Mon May 08, 2006 2:49 am
by someberry

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);
?>