I am testing out the function stat(file), which is supposed to return information on a file. Does this only work for PHP files? I wanted to see if it worked on an image eg: stat(image.jpg), but I get this warning error:
Warning: Division by zero in /hsphere/local/home/bruceg/inspired-evolution.com/stat.php on line 2
Warning: stat(): Stat failed for gif (errno=2 - No such file or directory) in /hsphere/local/home/bruceg/inspired-evolution.com/stat.php on line 2.
Also it doesn't work when I try stat(file.php).
I get the no such file or directory error even though both my test page and the file I am trying to get the information on are at the same directory level.
what gives?
stat(file) question
Moderator: General Moderators
the filename has to be a string
example:
print_r(stat("file.php"));
example:
print_r(stat("file.php"));
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
just tested it out
results in
Code: Select all
print_r(stat("hmm.php"));Code: Select all
Array
(
[0] => 2
[1] => 0
[2] => 33206
[3] => 1
[4] => 0
[5] => 0
[6] => 2
[7] => 64
[8] => 1143210267
[9] => 1143196727
[10] => 1143196632
[11] => -1
[12] => -1
[dev] => 2
[ino] => 0
[mode] => 33206
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 2
[size] => 64
[atime] => 1143210267
[mtime] => 1143196727
[ctime] => 1143196632
[blksize] => -1
[blocks] => -1
)Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
in the browser mine displays like that too
so i just view source and copy the output
you could do this:
so i just view source and copy the output
you could do this:
Code: Select all
echo nl2br(print_r(stat("file.php")));Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
actually that didn't work. but this did
Code: Select all
<?php
$array = stat("hmm.php");
echo "Array (<br />";
foreach($array AS $k=>$v){
echo " [$k] => $v<br />";
}
echo ")";
?>Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
viewtopic.php?t=45741 may be of interest.