zval结构体
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| struct _zval_struct { zend_value value; union { uint32_t type_info; struct { ZEND_ENDIAN_LOHI_3( zend_uchar type, zend_uchar type_flags, union { uint16_t extra; } u) } v; } u1; union { uint32_t next; uint32_t cache_slot; uint32_t opline_num; uint32_t lineno; uint32_t num_args; uint32_t fe_pos; uint32_t fe_iter_idx; uint32_t access_flags; uint32_t property_guard; uint32_t constant_flags; uint32_t extra; } u2; };
|
zend_value
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| typedef union _zend_value { zend_long lval; double dval; zend_refcounted *counted; zend_string *str; zend_array *arr; zend_object *obj; zend_resource *res; zend_reference *ref; zend_ast_ref *ast; zval *zv; void *ptr; zend_class_entry *ce; zend_function *func; struct { uint32_t w1; uint32_t w2; } ww; } zend_value;
|
zend_string 字符串
1 2 3 4 5 6
| struct _zend_string { zend_refcounted_h gc; zend_ulong h; size_t len; char val[1]; };
|
初始化
zend_string *zend_string_init(const char *str, size_t len, bool persistent)
zend_string_init(“hello world”,sizeof(“hello world”)-1,0)
zend_array 数组