Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Gets file permissions
<?php fileperms(string $filename): int|false
<?php             return chmod($path, $mode);

        }



        return substr(sprintf('%o', fileperms($path)), -4);

    }
<?php         file_put_contents(self::$tempDir.'/file.txt', 'Hello World');

        $files = new Filesystem;

        $files->chmod(self::$tempDir.'/file.txt', 0755);

        $filePermission = substr(sprintf('%o', fileperms(self::$tempDir.'/file.txt')), -4);

        $expectedPermissions = DIRECTORY_SEPARATOR === '\\' ? '0666' : '0755';

        $this->assertEquals($expectedPermissions, $filePermission);

    }
<?php     private function getFilePermissions($file)

    {

        $filePerms = fileperms($file);

        $filePerms = substr(sprintf('%o', $filePerms), -3);



        return (int) base_convert($filePerms, 8, 10);