Home > Bookmarks, PhP, Tech > Unset or Destroys Variable in PhP

Unset or Destroys Variable in PhP

January 7th, 2008 Leave a comment Go to comments

unset() destroys the specified variables.

<?php
// remove a single variable
unset($a);

// remove a single element in an array
unset($my_array['element']);

// remove multiple variables
unset($a, $b, $c);
?>

The behavior of unset() inside of a function can vary depending on what type of variable you are attempting to destroy.
In can be used to remove a single variable, multiple variables, or an element from an array. It is used as unset ($remove).

  1. No comments yet.
  1. No trackbacks yet.
GoCache - ByREV-Cache v1.0 - live served in : 0.13684 sec (gzip)