Seek in an open file in PHP

Description

The following code shows how to seek in an open file.

Example


/*from  w w  w  .ja  v a2s .c o  m*/
  
<?php
    $file = fopen("test.txt","r");
    // read first line
    fgets($file);
    // move back to beginning of file
    fseek($file,0);
?>




















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip