(PHP 5 >= 5.1.0)
SplFileObject::ftruncate — حذف باقی فایل در طول داده شده
حذف باقیمانده بایتهای فایل در size بایت.
اندازه برای برش.
Note:
اگر size بزرگتر از فایل باشد طول با استفاده از بایتهای null افزایش مییابد.
اگر size کوچکتر از فایل باشد داده بیشتر از بین خواهد رفت.
Returns TRUE on success or FALSE on failure.
Example #1 مثال SplFileObject::ftruncate()
<?php
// Create file containing "Hello World!"
$file = new SplFileObject("/tmp/ftruncate", "w+");
$file->fwrite("Hello World!");
// Truncate to 5 bytes
$file->ftruncate(5);
// Rewind and read data
$file->rewind();
echo $file->fgets();
?>
The above example will output something similar to:
Hello