基于 PHP 5.6.20
ZVAL——php变量实现的基础
_zval_struct 结构体的定义位于 Zend/zend.h 322 行
typedef union _zvalue_value {
long lval; /* long value */
double dval; /* double value */
struct {
char *val;
int len;
} str;
HashTable *ht; /* hash table value */
zend_object_value obj;
zend_ast *ast;
} zvalue_value; struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
zend_uint refcount__gc;
zend_uchar type; /* active type */
zend_uchar is_ref__gc;
};
其中,zvalue_value 用来存储实际的值、refcont__gc 应用于引用计数垃圾回收、type 表示实际的类型、is_ref__gc