SplFileInfo::__construct
PHP function
Edit on GitHub ✎
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
Construct a new SplFileInfo object
Description
SplFileInfo::__construct(string $filename)
Creates a new SplFileInfo object for the file_name specified. The file does not need to exist, or be readable.
Parameters
filenamePath to the file.
Examples
SplFileInfo::__construct() example
php
<?php
$info = new SplFileInfo('example.php');
if ($info->isFile()) {
echo $info->getRealPath();
}
?>