Q:

destroy php variable

// Destroy a variable
<?php
unset ($var1, $var2.... )
?>
3
<?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;
?>
1

<?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;
?>
 
1

New to Communities?

Join the community