destroy php variable
snippet in php

destroy php variable

user8582

<?php

$first = 100;
$second = 200;

$third = $first + $second;
echo "Sum = ".$third;
// Destroy a variable with unset function
unset($third);

//after delete the variable call it again to test
echo "Sum = ".$third;
?>

destroy php variable

user1324

// Destroy a variable
<?php
unset ($var1, $var2.... )
?>

php unset()

user5027


<?php

  $a = "Hello world!";
echo 
  "The value of variable 'a' before unset: " . $a . "<br>";

  unset($a);
echo 
  "The value of variable 'a' after unset: " . $a;
?>