function test($name, $lc, $lp)
{
    static $i = 0;
    echo "==={$i}===\n";
    $i++;
    $o = new SplFileInfo($name);
    var_dump($o);
    $c = clone $o;
    var_dump($c);
    var_dump($o === $c);
    var_dump($o == $c);
    var_dump($o->getPathname() == $c->getPathname());
    try {
        $f = new SplFileObject($name);
        var_dump($name);
        var_dump($f->getPathName());
        $l = substr($f->getPathName(), -1);
        var_dump($l != '/' && $l != '\\' && $l == $lc);
        var_dump($f->getFileName());
        $l = substr($f->getFileName(), -1);
        var_dump($l != '/' && $l != '\\' && $l == $lc);
        var_dump($f->getPath());
        $l = substr($f->getPath(), -1);
        var_dump($l != '/' && $l != '\\' && $l == $lp);
    } catch (LogicException $e) {
        echo "LogicException: " . $e->getMessage() . "\n";
    }
    try {
        $fo = $o->openFile();
        var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
    } catch (LogicException $e) {
        echo "LogicException: " . $e->getMessage() . "\n";
    }
}
<?php

$file = new SplFileObject('spl_file_object.php');
print 'Nome: ' . $file->getFileName() . '<br>' . PHP_EOL;
print 'Extensão: ' . $file->getExtension() . '<br>' . PHP_EOL;
$file2 = new SplFileObject('novo.txt', 'w');
$bytes = $file2->fwrite('Olá Mundo PHP' . PHP_EOL);
print 'Bytes escritos ' . $bytes . PHP_EOL;