Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Deletes a file
<?php unlink(string $filename, ?resource $context = null): bool
<?php     function unlink(...$arguments)

    {

        if ( ! is_mocked('unlink')) {

            return \unlink(...$arguments);

        }



        return return_mocked_value('unlink');
<?php         if (is_dir("$dir/$file")) {

            delete_directory("$dir/$file");

        } else {

            unlink("$dir/$file");

        }

    }

    rmdir($dir);
<?php         error_clear_last();



        if ( ! @unlink($location)) {

            throw UnableToDeleteFile::atLocation($location, error_get_last()['message'] ?? '');

        }

    }
<?php             case 'dir':

                return @rmdir((string) $file->getRealPath());

            case 'link':

                return @unlink((string) $file->getPathname());

            default:

                return @unlink((string) $file->getRealPath());

        }
<?php             case 'link':

                return @unlink((string) $file->getPathname());

            default:

                return @unlink((string) $file->getRealPath());

        }

    }
<?php             return;

        }



        unlink(self::ARCHIVE);

    }

}