fsync
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.1.0)
Synchronizes changes to the file (including meta-data)
Description
fsync(resource $stream): bool
This function synchronizes changes to the file, including its meta-data. This is similar to fflush(), but it also instructs the operating system to write to the storage media.
Parameters
streamAll
Return Values
Success
Examples
fsync() example
php
<?php
$file = 'test.txt';
$stream = fopen($file, 'w');
fwrite($stream, 'test data');
fwrite($stream, "\r\n");
fwrite($stream, 'additional data');
fsync($stream);
fclose($stream);
?>