CopyPastehas never been so tasty!

Uses of Unset() Function in PHP

by anonymous

  • 0
  • 0
  • 0
67 views

Orignal Source:http://codingvilla.com/uses-unset-function-php-single-article-577.aspx

Unset function in php:

 

Unset function is also known as destroy function. It is used to remove a variable in php. Variable can be single, multiple, and an element of an array. It is a built in function in php. The unset () function takes a variable that can be deleted or destroyed.

 

Syntax:

 

Unset ($remove).

 

Unset function for different variables in php:

 

 

<?php

 unset($a);                       // remove a single variable

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

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

?>

 

 

Code:

 

<?

$myvar = "This is a string";

    unset($myvar);     

?>

 

 

Above is a simple code to use unset () function in php.

 

This simple article tells that how we can use unset () function in php.

 

 

Add A Comment: