Home  >  Article  >  Backend Development  >  How to use rewind function

How to use rewind function

藏色散人
藏色散人Original
2019-02-18 11:13:175499browse

php rewind() function rewinds the position of the file pointer.

How to use rewind function

php rewind() function Syntax

Function: Rewind the position of the file pointer to the beginning of the file.

Syntax:

rewind(file)

Parameters:

file Required. Specifies an open file.

Description: If successful, return true. On failure, returns false.

php rewind() function example

<?php
$file = fopen("./test.txt","r");
//改变文件指针的位置
fseek($file,"13");
//把文件指针设定为 0
rewind($file);
//输出指针位置
echo ftell($file);
?>

This article is an introduction to the PHP rewind function. I hope it will be helpful to friends in need!

The above is the detailed content of How to use rewind function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn