Computer >> Computer tutorials >  >> Programming >> PHP

delete() function in PHP


The delete() function deletes a file. The path of the file to be deleted is to be specified as a parameter.

Syntax

delete(file_path)

Parameters

  • file_path − Specify the path of the file to be deleted.

Return

The delete() function returns.

  • True, on success
  • False, on failure

Example

The following is an example. This deletes the file “amit.txt” specified as a parameter.

<?php
   echo delete("E:/list/amit.txt");
?>

Output

true