1--TEST-- 2Test fileatime(), filemtime(), filectime() & touch() functions : usage variation 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--SKIPIF-- 6<?php 7if (substr(PHP_OS, 0, 3) == 'WIN') { 8 die('skip.. only for Non Windows Systems'); 9} 10?> 11--FILE-- 12<?php 13 14function stat_fn( $filename ) { 15 echo "\n-- File '$filename' --\n"; 16 echo "-- File access time is => "; 17 echo fileatime($filename)."\n"; 18 clearstatcache(); 19 echo "-- File modification time is => "; 20 echo filemtime($filename)."\n"; 21 clearstatcache(); 22 echo "-- inode change time is => "; 23 echo filectime($filename)."\n"; 24 clearstatcache(); 25 26 27} 28 29echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; 30echo "\n*** testing touch ***\n"; 31$a = touch(NULL); 32$b = touch(false); 33$c = touch(''); 34$d = touch(' '); 35$e = touch('|'); 36 37var_dump($a); 38var_dump($b); 39var_dump($c); 40var_dump($d); 41var_dump($e); 42 43echo "\n*** testing file info ***"; 44stat_fn(NULL); 45stat_fn(false); 46stat_fn(''); 47stat_fn(' '); 48stat_fn('|'); 49 50var_dump(unlink(' ')); 51var_dump(unlink('|')); 52 53echo "Done"; 54?> 55--EXPECTF-- 56*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** 57 58*** testing touch *** 59bool(false) 60bool(false) 61bool(false) 62bool(true) 63bool(true) 64 65*** testing file info *** 66-- File '' -- 67-- File access time is => 68-- File modification time is => 69-- inode change time is => 70 71-- File '' -- 72-- File access time is => 73-- File modification time is => 74-- inode change time is => 75 76-- File '' -- 77-- File access time is => 78-- File modification time is => 79-- inode change time is => 80 81-- File ' ' -- 82-- File access time is => %d 83-- File modification time is => %d 84-- inode change time is => %d 85 86-- File '|' -- 87-- File access time is => %d 88-- File modification time is => %d 89-- inode change time is => %d 90bool(true) 91bool(true) 92Done 93