Search Results

  1. SplFileObject::ftruncate (PHP 5 >= 5.1.0, PHP 7, PHP 8) SplFileObject::ftruncate — Truncates the file to a given length

  2. Jul 11, 2025 · Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more.

  3. Simple usage example of `SplFileObject::ftruncate ()`. The SplFileObject::ftruncate function is a method provided by PHP's SplFileObject class. This function allows you to truncate or shorten the contents of a file to a specified length. It can be used to remove part of a file, starting from the given length, effectively reducing the file size.

  4. If size is smaller than the file, the extra data will be lost.

  5. If size is smaller than the file, the extra data will be lost.

  6. Return Values Returns true on success or false on failure.

  7. The SplFileObject class Introduction The SplFileObject class offers an object oriented interface for a file.