SQL PHP HTML ASP JavaScript articles and free scripts to download
PHP Declaring Variables


We can destroy variable by using unset function.


Here is an example.
echo " before unset : ".$my_var;
echo "<br>";
echo "after unset : " .$my_var;
The output is here
before unset : plus2net
after unset  :
Unset function will remove local variable only. For example it can remove only variable inside the function and it does not affect outside the function. Here is one example to understand how unset function work inside function.

function unset_var()
global $my_var;
echo "Before unset and inside function :".$my_var."<br>";
echo "after unset and inside function  :".$my_var."<br>";

echo "Outside function before using function : ".$my_var."<br>";
echo "Outside function after using function : ".$my_var."<br>";
Here is the output
Outside function before using function : plus2net
Before unset and inside function :plus2net
after unset and inside function :
Outside function after using function : plus2net

Post Comment This is for short comments only. Use the forum for more discussions.
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2015 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer