首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

SplFileObject::getFlags

(PHP 5 >= 5.1.0, PHP 7)

SplFileObject::getFlags — Gets flags for the SplFileObject

Description

代码语言:javascript
复制
public int SplFileObject::getFlags ( void )

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

Parameters

This function has no parameters.

Return Values

Returns an integer representing the flags.

Examples

Example #1 SplFileObject::getFlags() example

代码语言:javascript
复制
<?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:

代码语言:javascript
复制
Not skipping empty lines
Skipping empty lines

See Also

  • SplFileObject::setFlags() - Sets flags for the SplFileObject

← SplFileObject::getCurrentLine

SplFileObject::getMaxLineLen →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券