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

fgetc

Description

The fgetc of Filesystem for PHP gets character from file pointer.

Syntax

fgetc(
    resource $stream
): string|false

Parameters

stream

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 stream. Returns false on EOF.

Examples

1 · stream

<?

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

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

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

        echo "$return\n";
    }

fclose($stream);

?>
h
e
l
l
o

HomeMenu