It returns file modification time
Example
<?php
echo date(“D M Y h i s”,filemtime(“test.txt”));
?>
Output
Fri May 2007 03 15 53
It returns file modification time
Example
<?php
echo date(“D M Y h i s”,filemtime(“test.txt”));
?>
Output
Fri May 2007 03 15 53
It returns file inode
Example
<?php
echo fileinode(“test.txt”);
?>
Output
673771
It returns file group
Example
<?php
echo filegroup(“test.txt”);
?>
Output
1000
It returns inode change time of file
Example
<?php
echo date(“D m Y h i s”,filectime(“test.txt”));
?>
Output
Fri 05 2007 03 15 53
It returns last access time of file
Example
<?php
echo date(“D m Y”,fileatime(“test.txt”));
?>
Output
Fri 05 2007
It reads entire file into an array
Example
<?php
echo “<pre>”;
print_r(file(“test.txt”));
?>
Output
Array
(
[0] => phpcodez
)
It writes a string to a file
Example
<?php
file_put_contents(“test.txt”,”phpcodez”);
?>
It reads entire file
Example
<?php
echo file_get_contents(“test.txt”);
?>
It checks whether a file or directory exists
Example
<?php
echo file_exists(“test.txt”)?”Yes”:”No”;
?>
It returns line from file pointer and strip HTML tags
Example
<?php
$fp = @fopen(“test.txt”, “r”);
if ($fp) {
while (($content = fgetss($fp, 4096)) !== false) {
echo $content;
}
fclose($fp);
}
?>