Variable reference count for php deep learning

Source: Internet
Author: User
: This article mainly introduces reference counting of variables learned in php. For more information about PHP tutorials, see. What is the reference count of php variables? First, let's take a look at the underlying structure of php variables:

Typedef struct _ zval_struct zval; struct _ zval_struct {zvalue_value value; // store value into refcount _ gc; // reference count zend_uchar type; // Judge type zend_uchar is_ref _ gc; // whether it is referenced };

When we declare a variable in the php program, the zend Engine will instantiate a zval struct, which has four member variables. Here, type is used to determine the type of the variable. value is used to store actual data. In fact, value is also a struct, which is not detailed here. Today we will focus on the usefulness of the refcount_gc and is_ref_gc fields. Suppose there is such a piece of code:

$ A = 123; $ B = $;

Because of a simple int type variable, php needs to instantiate a struct. in this case A and

Copyright Disclaimer: This article is an original article by the blogger. For more information, see the source.

The above describes the reference counting of php variables, including the reference counting. I hope to help anyone who is interested in PHP tutorials.

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.