<?php
$it = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::CURRENT_AS_FILEINFO);
foreach ($it as $fileinfo) {
echo $fileinfo->getFilename() . "\n";
}
?>
Output of the above example in PHP 8.2 is similar to:
.
..
apples.jpg
banana.jpg
example.php
Output of the above example prior to PHP 8.2.0 is similar to:
apples.jpg
banana.jpg
example.php