array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'splfileobject.getflags.php', 1 => 'SplFileObject::getFlags', 2 => 'Gets flags for the SplFileObject', ), 'up' => array ( 0 => 'class.splfileobject.php', 1 => 'SplFileObject', ), 'prev' => array ( 0 => 'splfileobject.getcurrentline.php', 1 => 'SplFileObject::getCurrentLine', ), 'next' => array ( 0 => 'splfileobject.getmaxlinelen.php', 1 => 'SplFileObject::getMaxLineLen', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splfileobject/getflags.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::getFlags — Gets flags for the SplFileObject
Gets the flags set for an instance of SplFileObject as an int.
Diese Funktion besitzt keine Parameter.
Returns an int representing the flags.
Beispiel #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";
}
?>
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
Not skipping empty lines Skipping empty lines