Get a single character from an open file in PHP

Description

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

Example


//  w  w w.j  av a2s  . c  o m

<?php
    $file = fopen("test.txt","r");
    echo fgetc($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