PHP unset () function destroys variables but does not implement free memory

Source: Internet
Author: User

<?

$a = "Hello";
$b = & $a;
Unset ($b);
echo $a; Output Hello
echo $b; Error
$b = "123456";
echo $a; Output Hello
echo $b; Output 123456
echo "
$a = "Hello";
$b = & $a;
unset ($a);
echo $a; Error
echo $b; Output Hello
$a = "123456";
echo $a; Output 123456
echo $b; Output Hello
echo "
Conclusion:
The PHP unset () function is used to destroy variables, but in many cases, the function only destroys the variable, and the value of the variable stored in the memory is still not destroyed.
That's not going to get what we want to do to free up memory. You can use the $ variable =null method to release its memory or to have two variables unset ();

Http://www.cnblogs.com/ellisonDon/archive/2012/11/19/2777453.html

?>

PHP unset () function destroys variables but does not implement free memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.