destroy variable php code example
Example 1: destroy php variable
// Destroy a variable
<?php
unset ($var1, $var2.... )
?>
Example 2: destroy php variable
<?php
$first = 100;
$second = 200;
$third = $first + $second;
echo "Sum = ".$third;
unset($third);
echo "Sum = ".$third;
?>
Example 3: php reset variable value
unset (var1, var2.... )
Example 4: php reset variable value
<?php
$xyz='w3resource.com';
echo 'Before using unset() the value of $xys is : '. $xyz.'<br>';
unset($xyz);
echo 'After using unset() the value of $xys is : '. $xyz;
?>