You can write variables to a file with file_put_contents(). If the file pointed to does not exist it will be created. By adding FILE_APPEND this will append data to the created file, if not the file will be over written.
<?php
$file = 'file.html';
$time = time();
$info = "Interation: $time</br>";
file_put_contents($file, $info, FILE_APPEND);
print "Script Ran at: $time";
?>
Be the first to comment