3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * @link http://www.php.net/manual/en/splfileinfo.getfilename.php */ $info = new SplFileInfo('/path/to/'); var_dump($info->getFilename()); $info = new SplFileInfo('http://example.com/path/to/'); var_dump($info->getFilename()); $info = new SplFileInfo('http://example.com/path/'); var_dump($info->getFilename()); $info = new SplFileInfo('http://example.com/'); var_dump($info->getFilename()); $info = new SplFileInfo('http://'); var_dump($info->getFilename()); $info = new SplFileInfo('http:/'); var_dump($info->getFilename());
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(2) "to" string(2) "to" string(4) "path" string(11) "example.com" string(5) "http:" string(5) "http:"
Output for 5.1.2 - 5.2.17
string(0) "" string(0) "" string(0) "" string(0) "" string(0) "" string(0) ""
Output for 5.0.0 - 5.1.1
Fatal error: Class 'SplFileInfo' not found in /in/1B3de on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: splfileinfo in /in/1B3de on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: splfileinfo in /in/1B3de on line 6