PHP unlink() Function

Delete a file

Definition and Usage

The unlink() function deletes a file.

Syntax

unlink(filename, context)

Parameter Values

Parameter Description
filename Required. Specifies the path to the file to delete
context Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream

Technical Details

Return Value: TRUE on success, FALSE on failure
PHP Version: 4.0+
PHP Changelog: PHP 5.0 - Added the context parameter

❮ PHP Filesystem Reference