php8.5
Home/ Manual/ spl / splfileobject/ SplFileObject::setFlags

SplFileObject::setFlags

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

Sets flags for the SplFileObject

Description

SplFileObject::setFlags(int $flags): void

Sets the flags to be used by the SplFileObject.

Parameters

flags

Bit mask of the flags to set. See SplFileObject constants for the available flags.

Return Values

Void

Examples

SplFileObject::setFlags example

php
<?php
$file = new SplFileObject("data.csv");
$file->setFlags(SplFileObject::READ_CSV);
foreach ($file as $fields) {
    var_dump($fields);
}
?>

See Also

  • SplFileObject::getFlags

Source: reference/spl/splfileobject/setflags.xml · from the official PHP manual (php/doc-en)