如何用c语言编写php7类的魔术函数(__ get和__set)

How to write the magic function(__get and __set) of PHP7's class in C language. I tried to solve it myself, but I found that it is too difficult for me.

My questions

  1. what meaning is the last argument of function named zend_read_property?
  2. How to return the property value of the object (return NULL if not exist)?

My code

ZEND_METHOD(Cheetah_Kernel_Object,__get) {
    char *name;
        int name_len;
    if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "s", &name, &name_len)
            == FAILURE) {
        RETURN_NULL()
    }

    zend_class_entry *ce = Z_OBJCE_P(getThis());
    zend_read_property(ce, getThis(), name, name_len, 0 TSRMLS_CC, {??});
    RETURN_NULL()
}