VOOZH about

URL: https://www.geeksforgeeks.org/php/php-splfileobject-ftruncate-function/

⇱ PHP | SplFileObject ftruncate() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP | SplFileObject ftruncate() Function

Last Updated : 11 Jul, 2025
The SplFileObject::ftruncate() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to truncates the file size in bytes. Syntax:
bool SplFileObject::ftruncate( $length )
Parameters: This function accept single parameter $length which specified the length of truncate of the file. Return values: This function returns True on success or False on failure. Below Programs illustrate the SplFileObject ftruncate() function in PHP: Program 1: Output:
Geeksfor
Program 2: Output:
Geeksfor
Contribu
Article
Reference: https://www.php.net/manual/en/splfileobject.ftruncate.php
Comment