SplFileObject
PHP Manual

SplFileObject::fgetc

(PHP 5 >= 5.1.0)

SplFileObject::fgetcGets character from file

Descripción

public string SplFileObject::fgetc ( void )

Gets a character from the file.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

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

Warning

Esta función quizá devuelve Boolean FALSE, pero quizá también devuelve un valor non-Boolean que se evaluará como FALSE, como 0 o "". Por favor lea la sección en Booleans para más información. Use el operador === para testear el valor devuelto por esta función.

Ejemplos

Example #1 SplFileObject::fgetc() example

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

Ver también


SplFileObject
PHP Manual