<?php .....Condition........ ...................... unlink(image path/test.png); .....Condition........ ...................... ?>
or
<?php $xx = fopen('testing.html', 'a'); fwrite($xx, '<h1>Hello EWA!</h1>'); fclose($xx); unlink('testing.html'); ?>
unset() is a function for variable management. It will make a variable undefined. Or we can say that unset() is used to null out the value of a given variable. OR Unset () is used to destroy a variable in PHP. In can be used to remove a single variable, multiple variables, or an element from an array.
Example for unset() :
<?php $value = 200; echo $value; //Out put will be 200 $value1 = unset($value); echo $value1; //Output will be null ?> <?php unset($value); // remove a single variable unset($my_array['element']); //remove a single element in an array unset($value1, $value2, $value3); // remove multiple variables ?>
Hope this will be helpful to someone. Thanks