SplFileObject
PHP Manual

SplFileObject::getFlags

(PHP 5 >= 5.1.0)

SplFileObject::getFlagsGets flags for the SplFileObject

설명

public int SplFileObject::getFlags ( void )

Gets the flags set for an instance of SplFileObject as an integer.

인수

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

반환값

Returns an integer representing the flags.

예제

Example #1 SplFileObject::getFlags example

<?php
$file 
= new SplFileObject(__FILE__"r");

if (
$file->getFlags() & SplFileObject::SKIP_EMPTY) {
    echo 
"Skipping empty lines\n";
} else {
    echo 
"Not skipping empty lines\n";
}

$file->setFlags(SplFileObject::SKIP_EMPTY);

if (
$file->getFlags() & SplFileObject::SKIP_EMPTY) {
    echo 
"Skipping empty lines\n";
} else {
    echo 
"Not skipping empty lines\n";
}
?>

위 예제의 출력 예시:

Not skipping empty lines
Skipping empty lines

참고


SplFileObject
PHP Manual