Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45654 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3646 invoked from network); 2 Oct 2009 14:46:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2009 14:46:30 -0000 Authentication-Results: pb1.pair.com header.from=scope@planetavent.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=scope@planetavent.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain planetavent.de from 89.107.186.104 cause and error) X-PHP-List-Original-Sender: scope@planetavent.de X-Host-Fingerprint: 89.107.186.104 xa8.serverdomain.org Received: from [89.107.186.104] ([89.107.186.104:57095] helo=xa8.serverdomain.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/F0-32165-44216CA4 for ; Fri, 02 Oct 2009 10:46:29 -0400 Received: from [192.168.3.1] (xdsl-84-44-154-131.netcologne.de [84.44.154.131]) by xa8.serverdomain.org (xa8.serverdomain.org) with ESMTP id 5CCDC28514706; Fri, 2 Oct 2009 16:46:23 +0200 (CEST) Message-ID: <4AC61244.7020202@planetavent.de> Date: Fri, 02 Oct 2009 16:46:28 +0200 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Mathieu Suen CC: internals@lists.php.net References: <4AC5A4A6.5060106@easyflirt.com> In-Reply-To: <4AC5A4A6.5060106@easyflirt.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Doc on the VM From: scope@planetavent.de (Nicolai Scheer) 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