PHP 8.1.28 Released!

SplFileObject::fgetc

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

SplFileObject::fgetcGets character from file

Descrizione

public SplFileObject::fgetc(): string|false

Gets a character from the file.

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

Returns a string containing a single character read from the file or false on EOF.

Avviso

Questa funzione può restituire il Booleano false, ma può anche restituire un valore non-Booleano valutato come false. Fare riferimento alla sezione Booleans per maggiori informazioni. Usare l'operatore === per controllare il valore restituito da questa funzione.

Esempi

Example #1 SplFileObject::fgetc() example

<?php
$file
= new SplFileObject('file.txt');
while (
false !== ($char = $file->fgetc())) {
echo
"$char\n";
}
?>

Vedere anche:

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top