how to use unlink function in php : I Want to use this code update image working fine but. I have need add unlink function this code so please help me ... where add code **unlink function**. I am using PHP 7.2 and database 

> Note: the Previous File Delete in a file after update new file

**php update script here...**

    <?php
    if(isset($_POST['submit']))
    {

      $sql1 = "SELECT * FROM banner WHERE banner_id='$banner_id'";

      $result1 = mysqli_query($conn, $sql1);

      mysqli_num_rows($result1) > 0;

      $row1 = mysqli_fetch_assoc($result1);

      $fileinfo = @getimagesize($_FILES["image"]["tmp_name"]);

      $width = $fileinfo[0];

      $height = $fileinfo[1];

      if(!empty($_FILES['image'] ['name'])) {

        $extension = pathinfo($_FILES['image'] ['name'], PATHINFO_EXTENSION);

        $image = "Banner".'-'. rand(10000,99999) . '.' . $extension;

	}
     if (($_FILES["image"]["size"] > 2000000)) {

        $response = array(

        "type" => "error",

        $_SESSION['msg1'] = "Image size exceeds 2MB" );

       } else if ($width < "900" || $height < "250") {

         $response = array(

        "type" => "error",

       $_SESSION['msg2'] = "the image should be used greater than 900 X 250 "
                    );

                } else {

	$location = "../image/banner/".$image;

        if(in_array(strtolower($extension), [ 'png', 'jpeg', 'jpg', ])){

         compressImage($_FILES['image']['tmp_name'],$location,60);}

         else{$image=$row1['image'];}
	

    $sql=mysqli_query($conn,"update  banner set Image='$image' where 
    banner_id='$banner_id' ");

	  $_SESSION['msg']="Successfully Banner Image Updated Successfully !!";
     }
    }
    ?>