What is unlink in PHP

In this article I am going to explain about unlink function in PHP.
  • 1301

PHP unlink() Function

The filesystem unlink function deletes a file. The unlink function returns true on success or false on failure.

Syntax of unlink function

unlink(fileName, context)

Parameters in unlink function

It have two parameter:

Parameter Description
fileName It specifies the file to delete.
context It specifies the context of the file handle.

Example of filesystem unlink function

<html>

<body>

<?php

$fileName = "sachin.php";

if (!unlink($fileName))

  {

  echo ("Error deleting $fileName");

  }

else

  {

  echo (" $fileName Deleted");

  }

?>

</body>

</html>


Output:

ulink-php.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.