Page 1 of 1

Using the PHP stat Function

New postPosted: Sat Dec 28, 2013 3:14 pm
by Cat
Code: [Select all] [Expand/Collapse] [Download] (Untitled)
<?php
$file_name = "308Demo.php";
$these_stats = stat($file_name);
echo "Status of file <b>$file_name</b>
<b>Device:</b> $these_stats[0]<br />
<b>Inode:</b> $these_stats[1]<br />
<b>Inode protection mode:</b> $these_stats[2]<br />
<b>Number of links:</b> $these_stats[3]<br />
<b>User id of owner:</b> 110<br />
<b>Group id owner:</b> 200<br />
<b>Device type if inode device:</b> $these_stats[6]<br />
<b>Size in bytes:</b> $these_stats[7]<br />
<b>Time of last access:</b> $these_stats[8]<br />
<b>Time of last modification:</b> $these_stats[9]<br />
<b>Time of last change:</b> $these_stats[10]<br />
<b>Blocksize for filesystem I/O:</b> $these_stats[11]<br />
<b>Number of blocks allocated:</b> $these_stats[12]<br />";
?>


Demo!



Anyone who wishes to make additions or changes to this tutorial email them to webmaster@linuxguruz.com