<?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.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.21 - 8.1.28, 8.2.8 - 8.2.18, 8.3.0 - 8.3.6
- string(2) "to"
string(2) "to"
string(4) "path"
string(11) "example.com"
string(5) "http:"
string(5) "http:"
- Output for 8.1.0 - 8.1.20, 8.2.0 - 8.2.7
- string(2) "to"
string(2) "to"
string(4) "path"
string(11) "example.com"
string(0) ""
string(5) "http:"
- Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17
- string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
- Output for 5.0.0 - 5.0.5, 5.1.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.3.11, 4.4.0 - 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
preferences:
275.78 ms | 401 KiB | 314 Q