In this segment of the PHP tutorial we will learn the ftruncate function of the file handling
In this segment of the PHP tutorial we will learn the ftruncate function of the file handlingSyntax
int ftruncate(file_handle,length)
Code
<?php
$file1=fopen("bb.txt","r");
echo "file size is
".filesize("bb.txt");
ftruncate($file1,100);
echo "<br>now
the file size is ".filesize("bb.txt");
?>
Output
file size is 300
now the file size is 200