PHP » I/O » fgetc()

Syntax:
string fgetc(int file)
file
File handle of the file to read a character from.

Reads a character from a file.

fgetc() returns a string with a character from the specified file. If EOF has been reached, FALSE is returned.

Examples

Code:
<?php

$filename = "log.txt";

$logfile = fopen($filename, "r");
$char = fgetc($logfile);
print "First character of $filename is: $char";

?>
Output:
First character of log.txt is: S
Explanation:

This code reads and prints a character from a file.

See Also: