Return to 005_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test fileatime(), filemtime(), filectime() & touch() functions : basic functionality 3: --FILE-- 4: <?php 5: /* 6: Prototype: int fileatime ( string $filename ); 7: Description: Returns the time the file was last accessed, or FALSE 8: in case of an error. The time is returned as a Unix timestamp. 9: 10: Prototype: int filemtime ( string $filename ); 11: Description: Returns the time the file was last modified, or FALSE 12: in case of an error. 13: 14: Prototype: int filectime ( string $filename ); 15: Description: Returns the time the file was last changed, or FALSE 16: in case of an error. The time is returned as a Unix timestamp. 17: 18: Prototype: bool touch ( string $filename [, int $time [, int $atime]] ); 19: Description: Attempts to set the access and modification times of the file 20: named in the filename parameter to the value given in time. 21: */ 22: 23: echo "*** Testing the basic functionality with file ***\n"; 24: print( @date('Y:M:D:H:i:s', fileatime(__FILE__)) )."\n"; 25: print( @date('Y:M:D:H:i:s', filemtime(__FILE__)) )."\n"; 26: print( @date('Y:M:D:H:i:s', filectime(__FILE__)) )."\n"; 27: print( @date('Y:M:D:H:i:s', touch(dirname(__FILE__)."/005_basic.tmp")) )."\n"; 28: 29: echo "*** Testing the basic functionality with dir ***\n"; 30: print( @date('Y:M:D:H:i:s', fileatime(".")) )."\n"; 31: print( @date('Y:M:D:H:i:s', filemtime(".")) )."\n"; 32: print( @date('Y:M:D:H:i:s', filectime(".")) )."\n"; 33: print( @date('Y:M:D:H:i:s', touch(dirname(__FILE__)."/005_basic")) )."\n"; 34: 35: echo "\n*** Done ***\n"; 36: ?> 37: --CLEAN-- 38: <?php 39: unlink(dirname(__FILE__)."/005_basic.tmp"); 40: unlink(dirname(__FILE__)."/005_basic"); 41: ?> 42: --EXPECTF-- 43: *** Testing the basic functionality with file *** 44: %d:%s:%s:%d:%d:%d 45: %d:%s:%s:%d:%d:%d 46: %d:%s:%s:%d:%d:%d 47: %d:%s:%s:%d:%d:%d 48: *** Testing the basic functionality with dir *** 49: %d:%s:%s:%d:%d:%d 50: %d:%s:%s:%d:%d:%d 51: %d:%s:%s:%d:%d:%d 52: %d:%s:%s:%d:%d:%d 53: 54: *** Done ***