Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

fgetc

Description

Gets character from file pointer

Syntax

fgetc ( resource $handle ) : string

Parameters

handle

The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()).

Return

Returns a string containing a single character read from the file pointed to by handle. Returns FALSE on EOF.

Examples

1

<?

$filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/txt/file.txt";
$mode = "r";

$handle = fopen($filename, $mode);

    while (!feof($handle))
    {
        $return = fgetc($handle);

        echo "$return\n";
    }

fclose($handle);

?>
H
e
l
l
o

HomeMenu