Hi!
Mathieu Suen schrieb:
> Hi,
>
> I would like to know if there is some documentation on the different
> layout of the array, object varaible ... in php.
> Or were in the source can we read how the php VM reprensent those entites?
At first, you should have a look at Zend/zend.h in the php source tree.
There you'll find the definition of a "php variable", the zval struct:
struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
zend_uint refcount__gc;
zend_uchar type; /* active type */
zend_uchar is_ref__gc;
};
The content of the variable is:
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;
} zvalue_value;
Since a php variable can contain any type php has to offer, this
representation was choosen in order to simplify access on the internal side.
There's a bunch of macros for creating zvals, getting/setting
types/values, etc. so you don't need to do this by hand (of course, in
complex cases you have to).
Does this help?
greetings,
Nico
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php