Do one at a time, because there is no rush and enough space:
$file = 'file.txt';
$fd = fopen($file, "a");
if ($fd) {
fwrite($fd, 'message to be written' . "\n");
fclose($fd);
}
Especially simplify the code if you encounter an error message.
Also know your language: a resource in PHP always evaluates to true.
And know your brain: double negation is difficult, always.
hakre source
share