PHP Velho Oeste 2024

SplFileObject::fgetc

(PHP 5 >= 5.1.0, PHP 7)

SplFileObject::fgetcGets character from file

설명

public string SplFileObject::fgetc ( void )

Gets a character from the file.

인수

이 함수는 인수가 없습니다.

반환값

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

Warning

이 함수는 논리 FALSE를 반환하지만, 논리 FALSE로 취급할 수 있는 다른 값을 반환할 수 있습니다. 자세한 정보는 논리형 섹션을 참고하십시오. 이 함수의 반환값을 확인하려면 === 연산자를 이용하십시오.

예제

Example #1 SplFileObject::fgetc() example

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

참고

add a note add a note

User Contributed Notes

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