It creates a temporary file
Example
<?php
$fp = tmpfile();
fwrite($fp, “phpccodez”);
rewind($fp);
echo fread($fp,1024);
fclose($fp);
?>
Output
phpccodez
It creates a temporary file
Example
<?php
$fp = tmpfile();
fwrite($fp, “phpccodez”);
rewind($fp);
echo fread($fp,1024);
fclose($fp);
?>
Output
phpccodez
It create file with unique file name
Example
<?php
echo tempnam(“/var/www/test/”,”test.txt”);
?>
Output
/var/www/test/test.txtcpijNs
It creates a symbolic link
Example
<?php
$link = ‘test’;
symlink(“test.txt”, $link);
echo readlink($link);
?>
Output
test.txt
It returns information about a file
Example
<?php
echo “<pre>”;
print_r(stat(“test.txt”));
?>
Output
Array
(
[0] => 2049
[1] => 673769
[2] => 33279
[3] => 1
[4] => 33
[5] => 33
[6] => 0
[7] => 8
[8] => 1336816154
[9] => 1336816154
[10] => 1336816154
[11] => 4096
[12] => 8
[dev] => 2049
[ino] => 673769
[mode] => 33279
[nlink] => 1
[uid] => 33
[gid] => 33
[rdev] => 0
[size] => 8
[atime] => 1336816154
[mtime] => 1336816154
[ctime] => 1336816154
[blksize] => 4096
[blocks] => 8
)
It sets write file buffering on the given stream
Example
<?php
$fp = fopen(“test.txt”, “w”);
if ($fp) {
stream_set_write_buffer($fp, 0);
fwrite($fp, “PHPCodez”);
fclose($fp);
}
?>
Its an alias of stream_set_write_buffer() and sets write file buffering on the given stream
Example
<?php
$fp = fopen(“test.txt”, “w”);
if ($fp) {
set_file_buffer($fp, 0);
fwrite($fp, “PHPCodez”);
fclose($fp);
}
?>
It can be used to remove a directory
Example
<?php
rmdir(‘test’) or die(“Failed”);
?>
It rewinds the position of a file pointer
Example
<?php
$fp = fopen(‘test.txt’, ‘r+’);
fwrite($fp, ‘PHPCodez’);
rewind($fp);
fwrite($fp, ‘phpcodez’);
fclose($fp);
?>
It renames a file or directory
Example
<?php
rename(“test.txt”, “new-test.txt”);
?>
It returns realpath cache size
Example
<?php
echo “<pre>”;
print_r(realpath_cache_size());
?>
Output
344