zoukankan      html  css  js  c++  java
  • php 变量的结构和实现

    php版本 7.2.3

    文件地址:Zend/zend_types.h

    typedef struct _zval_struct     zval;

    变量的存储结构

    struct _zval_struct {
        zend_value        value;            /* value */
        union {
            struct {
                ZEND_ENDIAN_LOHI_4(
                    zend_uchar    type,            /* active type */
                    zend_uchar    type_flags,
                    zend_uchar    const_flags,
                    zend_uchar    reserved)        /* call info for EX(This) */
            } v;
            uint32_t type_info;
        } u1;
        union {
            uint32_t     next;                 /* hash collision chain */
            uint32_t     cache_slot;           /* literal cache slot */
            uint32_t     lineno;               /* line number (for ast nodes) */
            uint32_t     num_args;             /* arguments number for EX(This) */
            uint32_t     fe_pos;               /* foreach position */
            uint32_t     fe_iter_idx;          /* foreach iterator index */
            uint32_t     access_flags;         /* class constant access flags */
            uint32_t     property_guard;       /* single property guard */
            uint32_t     extra;                /* not further specified */
        } u2;
    };
    value:存放变量值
    u1:变量的属性
    u2:变量被使用时使用

    变量值的实际存储结构,一个联合体(节省空间)

     1 typedef union _zend_value {
     2     zend_long         lval;                /* long value */
     3     double            dval;                /* double value */
     4     zend_refcounted  *counted;
     5     zend_string      *str;
     6     zend_array       *arr;
     7     zend_object      *obj;
     8     zend_resource    *res;
     9     zend_reference   *ref;
    10     zend_ast_ref     *ast;
    11     zval             *zv;
    12     void             *ptr;
    13     zend_class_entry *ce;
    14     zend_function    *func;
    15     struct {
    16         uint32_t w1;
    17         uint32_t w2;
    18     } ww;
    19 } zend_value;
    for remember
  • 相关阅读:
    谷歌地图地理解析和反解析geocode.geocoder详解(转)
    Html5 Geolocation获取地理位置信息(转)
    利用单片机快速实现家庭智能控制平台
    邪恶改装:TPYBoard制作廉价WIFI干扰器
    [TPYBoard
    [TPYBoard
    [TPYBoard
    python中的subprocess.Popen()使用
    KVM虚拟机的xml配置文件
    Linux LVM 总结
  • 原文地址:https://www.cnblogs.com/dearmrli/p/8574921.html
Copyright © 2011-2022 走看看