/** * @en Change file extension * @ru Изменяет расширение файла * * $result = filesystem::change_extension('my.txt', 'html'); # bool(true) on success and bool(false) otherwise * * @param string $file_path * @param string $new_extension New extension (dot is not required) * * @return string */ public static function change_extension($file_path, $new_extension) { $new_path = filesystem::file_dir($file_path) . DIRECTORY_SEPARATOR . filesystem::file_name($file_path) . '.' . $new_extension; return filesystem::rename($file_path, $new_path); }