PHP 8.5.0 Beta 1 available for testing

Voting

: min(zero, six)?
(Example: nine)

The Note You're Voting On

emailfire at gmail dot com
14 years ago
If you want to empty a file of it's contents bare in mind that opening a file in w mode truncates the file automatically, so instead of doing...

<?php
$fp
= fopen("/tmp/file.txt", "r+");
ftruncate($fp, 0);
fclose($fp);
?>

You can just do...

<?php
$fp
= fopen("/tmp/file.txt", "w");
fclose($fp);
?>

<< Back to user notes page

To Top