Get a line from an open file in PHP

Description

The following code shows how to get a line from an open file.

Example


//  w w  w  . j ava 2  s  . co  m
<?php
    $file = fopen("test.txt","r");
    echo fgets($file);
    fclose($file);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




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