← All built-ins / unlink()

unlink()

unlink(string $s): bool

Parameters

NameTypeDescription
$pathstringfile to delete

Return value

true on success.

Example

file_put_contents("/tmp/hphp_doc_u.txt", "x");
var_dump(unlink("/tmp/hphp_doc_u.txt"));
var_dump(file_exists("/tmp/hphp_doc_u.txt"));
bool(true)
bool(false)

See also

rename()rmdir()