fgetc

Gets character from file pointer

&reftitle.description; ``string``false```fgetc` `resource` `stream`

Gets a character from the given file pointer.

&reftitle.parameters;

`stream`

- &fs.validfp.all;
&reftitle.returnvalues;

Returns a string containing a single character read from the file pointed to by `stream`. Returns &false; on EOF.

&return.falseproblem;
&reftitle.examples;

### A `fgetc` example

    <?php
    $fp = fopen('somefile.txt', 'r');
    if (!$fp) {
        echo 'Could not open file somefile.txt';
    }
    while (false !== ($char = fgetc($fp))) {
        echo "$char\n";
    }
    ?>

&reftitle.notes; ¬e.bin-safe;
&reftitle.seealso;

- `fread`
- `fopen`
- `popen`
- `fsockopen`
- `fgets`