FilesystemIterator::setFlags

Sets handling flags

&reftitle.description; public `void` `FilesystemIterator::setFlags` `int` `flags`

Sets handling flags.

&reftitle.parameters;

`flags`

- The handling flags to set. See the FilesystemIterator constants.

&reftitle.returnvalues;

&return.void;

&reftitle.examples;

### `FilesystemIterator::key` example

This example demonstrates the difference between the FilesystemIterator::KEY_AS_PATHNAME and FilesystemIterator::KEY_AS_FILENAME flags.

    <?php
    $iterator = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::KEY_AS_PATHNAME);
    echo "Key as Pathname:\n";
    foreach ($iterator as $key => $fileinfo) {
        echo $key . "\n";
    }

    $iterator->setFlags(FilesystemIterator::KEY_AS_FILENAME);
    echo "\nKey as Filename:\n";
    foreach ($iterator as $key => $fileinfo) {
        echo $key . "\n";
    }
    ?>

&example.outputs.similar;

    Key as Pathname:
    /www/examples/apple.jpg
    /www/examples/banana.jpg
    /www/examples/example.php

    Key as Filename:
    apple.jpg
    banana.jpg
    example.php

&reftitle.seealso;

- `FilesystemIterator::__construct`
- `FilesystemIterator::getFlags`