Hàm fflush() đẩy dữ liệu đệm (buffered output) ra tập tin đang mở. Buộc ghi toàn bộ dữ liệu trong bộ đệm xuống tài nguyên mà con trỏ tập tin trỏ đến.
Cú pháp
fflush(file_pointer)
Tham số
file_pointer – Con trỏ luồng tập tin đang mở.
Giá trị trả về
TRUE– Thành côngFALSE– Thất bại
Ví dụ 1
<?php
$file_pointer = fopen("one.txt", "r+");
fflush($file_pointer);
?>
Kết quả
test line
Ví dụ 2
<?php
$file_pointer = fopen("two.txt", "r");
$res = fgets($file_pointer);
while (!feof($file_pointer))
fflush($file_pointer);
fclose($file_pointer);
?>
Kết quả
Java is a programming language. JavaScript is a scripting language.