- var_dump: documentation ( source)
<?php
function test($path) {
echo "Testing: $path\n";
$file = new \SplFileInfo($path);
var_dump($file->getBasename());
var_dump($file->getFilename());
}
test('/dir/anotherdir/basedir//');
test('/dir/anotherdir/basedir/');
test('/dir/anotherdir/basedir');
test('/dir/anotherdir//basedir');
test('///');
test('//');
test('/');
test('');