kphp
kphp copied to clipboard
Implemented touch() function.
Please integrate function touch().
I don't understood how to add unit-tests , but i wrote it. Please add.
unit-test:
<?php
$filename = tempnam("/tmp", "ktouch");
$time1 = filemtime($filename);
sleep( 3 );
$rc = touch($filename, time()-30, time()-50);
if (!$rc) {
throw new \RuntimeException("touch() failed: $filename. rc=$rc");
}
$time2 = filemtime($filename);
if ( $time1 === $time2 ) throw new \RuntimeException("touch() does not work: $time1 !== $time2");
echo "ok\n";