How to don´t write if exist
| From: | Jan Grafström | Date: | Fri, 06 Apr 2001 03:59:04 +0000 |
| Subject: | How to don´t write if exist | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47392@lists.php.net to get a copy of this message | ||
Hi!
I want php to check if a word already exist and then don´t write it to
the file.
This is my file list.txt:
car, cat, dog, ...
and my php which need some more function:
------
$fp = fopen("list.txt", "a");
$string = "$word".","." ";
fwrite ($fp, $string);
fclose ($fp);
-------
I want to add: If the variable word exist, don´t add it to the string.
Thanks for any tips.
Regards
Jan