Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

rewind

Description

The rewind of Filesystem for PHP rewind the position of a file pointer.

Syntax

rewind ( resource $handle ) : bool

Parameters

handle

The file pointer must be valid, and must point to a file successfully opened by fopen().

Return

Returns TRUE on success or FALSE on failure.

Examples

1

<?

$filename = 'rewind.txt';
$mode = 'r+';

$handle = fopen($filename, $mode);

    fwrite($handle, 'Really long sentence');
    
    rewind($handle);
    fwrite($handle, 'Hello,');
    
    rewind($handle);
    fpassthru($handle);

fclose($handle);

?>
Hello, long sentence
HomeMenu