Nandeesh Mp Developer & Open Source Enthusiast

Standard PHP Library - Part 1

As per the PHP documentation, SPl is a set of classes and interfaces that solve common problems.

SPL has bunch of very useful tools. Seems like due to the lack of documentation, people are having hard time in understanding. Let me try to assimilate SPL one feature at a time. To begin with DirectoryIterator.

$directory = new DirectoryIterator('../public');
foreach ($directory as $key => $file) {
    if ($file->isFile()) {
        $files[] = clone $file;
    }
}
echo $files[1]->getFilename();

Points to note