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);
}
?>
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
It returns realpath cache entries
Example
<?php
echo “<pre>”;
print_r(realpath_cache_get());
?>
It returns the target of a symbolic link
Example
<?php
echo readlink(‘test’);
?>
It outputs a file
Example
<?php
$file = ‘test.txt’;
if (file_exists($file)) {
header(‘Content-Description: File Transfer’);
header(‘Content-Type: application/octet-stream’);
header(‘Content-Disposition: attachment; filename=’.basename($file));
header(‘Content-Transfer-Encoding: binary’);
header(‘Expires: 0’);
header(‘Cache-Control: must-revalidate’);
header(‘Pragma: public’);
header(‘Content-Length: ‘ . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
It opens process file pointer
Example
<?php
$pfp = popen(‘/bin/ls’, ‘r’);
pclose($pfp);
?>