(PHP 5 >= 5.1.0, PHP 7)
SplFileObject::getFlags — Gets flags for the SplFileObject
public SplFileObject::getFlags ( ) : int
Gets the flags set for an instance of SplFileObject as an int.
This function has no parameters.
Returns an int 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";
}
?> The above example will output something similar to:
Not skipping empty lines Skipping empty lines
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/splfileobject.getflags.php