SplFileObject::getFlags

(PHP 5 >= 5.1.0, PHP 7)

SplFileObject::getFlagsGets flags for the SplFileObject

Descrierea

public SplFileObject::getFlags ( ) : int

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

Parametri

Această funcție nu are parametri.

Valorile întoarse

Returns an int representing the flags.

Exemple

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";
}
?>

Exemplul de mai sus va afișa ceva similar cu:

Not skipping empty lines
Skipping empty lines

A se vedea și

add a note add a note

User Contributed Notes

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