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
32$dir = __DIR__ . '/005_variation2';
33mkdir($dir);
34chdir($dir);
35
36$b = touch(false);
37$c = touch('');
38$d = touch(' ');
39$e = touch('|');
40
41var_dump($a);
42var_dump($b);
43var_dump($c);
44var_dump($d);
45var_dump($e);
46
47echo "\n*** testing file info ***";
48stat_fn(false);
49stat_fn('');
50stat_fn(' ');
51stat_fn('|');
52
53var_dump(unlink(' '));
54var_dump(unlink('|'));
55rmdir($dir);
56
57echo "Done";
58?>
59--EXPECTF--
60*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
61
62*** testing touch ***
63
64Warning: Undefined variable $a in %s on line %d
65NULL
66bool(false)
67bool(false)
68bool(true)
69bool(true)
70
71*** testing file info ***
72-- File '' --
73-- File access time is =>
74-- File modification time is =>
75-- inode change time is =>
76
77-- File '' --
78-- File access time is =>
79-- File modification time is =>
80-- inode change time is =>
81
82-- File ' ' --
83-- File access time is => %d
84-- File modification time is => %d
85-- inode change time is => %d
86
87-- File '|' --
88-- File access time is => %d
89-- File modification time is => %d
90-- inode change time is => %d
91bool(true)
92bool(true)
93Done
94