- time: documentation ( source)
- date: documentation ( source)
- file_put_contents: documentation ( source)
<?php
$logfile = $argv[1];
function doLog($msg)
{
global $logfile;
$datestr = date("Y-M-d H:i:s T",time());
$msg="[".$datestr."]". $msg . "\n";
file_put_contents($logfile, $msg, FILE_APPEND);
}
doLog("Starting test");
$i = 0;
while(true)
{
echo "Echoing a string to standard out!!!\n";
if((++$i % 10) == 0)
{
doLog("Completed $i iterations");
}
}
doLog("Script exited normally");
return 0;
?>