example:
If
Code: Select all
foobarit wont write another same line that says
Code: Select all
foobarfoobar is ISNT in the text file, then
foobar would be written on the text file.
Hope this is clear enough!
Moderator: General Moderators
Code: Select all
foobarCode: Select all
foobarCode: Select all
if (in_array($string . "\n", file('file.txt'))) {
echo 'The line ' . $string . ' exists in the file.';
} else {
echo 'not found';
}