How to use rewind in PHP
In this article I am going to explain about rewind function in PHP.
PHP rewind() Function
The filesystem rewind function rewind the position of a file pointer.
Syntax of rewind function
Parameters in rewind function
It has only one parameter:
Parameter |
Description |
file |
Specifies open file. |
Example of filesystem rewind function
<html>
<body>
<?php
$file = fopen("C:\wamp\www\Dinesh\PhpIntro.txt","r+");
echo "Orignal content:"."</br>";
echo fread($file, filesize("C:\wamp\www\Dinesh\PhpIntro.txt"))."</br>";
fwrite($file,"IsRewind function");
rewind($file);
fwrite($file,"This is");
rewind($file);
echo "After the use of rewind function:"."</br>";
echo fread($file, filesize("C:\wamp\www\Dinesh\PhpIntro.txt"));
fclose($file);
?>
</body>
</html>
|
Output:
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here