Types

Zend Engine 2 Variable Types

Boolean Types

Types related to bool

zend_bool

A boolean value

A zend_bool should generally only contain a 1 or 0

Internally, zend_bool is an 'unsigned char'

Example:

zend_bool mybool;

Character and String Types

Types related to char and String

zend_uchar

An unsigned character

An unsigned character can generally contain values from 0x00 to 0xFF (depending on the host system)

Internally, zend_uchar is an 'unsigned char'

Example:

zend_uchar space = 0x20;

Data Structures

Data Structures

zend_class_entry

A userspace class

Properties:

type property description
char type
char* name userspace name of the class
zend_uint name_length size of the name property (exluding the NULL terminator)
zend_class_entry* parent class which this class extends
int refcount
zend_bool constants_updated
zend_uint ce_flags
HashTable function_table
HashTable default_properties
HashTable properties_info
HashTable default_static_members
HashTable* static_members
HashTable constants_table
zend_function_entry* builtin_functions userspace methods of this class
zend_function* constructor the constructor method
zend_function* destructor the destructor method
zend_function* clone the clone method
zend_function* __get the get property method
zend_function* __set the set property method
zend_function* __unset the unset property method
zend_function* __isset method to test if a property is set
zend_function* __call method to call when no method exists
zend_function* __tostring method to call when casting to a string
zend_function* serialize_func method to call during serialization
zend_function* unserialize_func method to call during unserialization
zend_class_iterator_funcs iterator_funcs
zend_object_value* class_type
zend_object_iterator* get_iterator
int* interface_gets_implemented a class implements this interface
int* serialize serializer callback
int* unserialize unserialize callback
zend_class_entry** interfaces
zend_uint num_interfaces
char* filename filename in which this class is defined, for userspace defined classes
zend_uint line_start line on which this class definition starts, for userspace defined classes
zend_uint line_end line on which this class definition ends, for userspace defined classes
char* doc_comment documentation comment block, for userspace defined classes
zend_uint doc_comment_len length of the documentation comment (excluding the NULL terminator)
zend_module_entry* module

zend_function_entry

A userspace function entry

Properties:

type property description
char* fname userspace name of the function
void* handler
zend_arg_info* arg_info
zend_uint num_args number of arguments to this function
zend_uint flags

zend_object

A userspace object

Properties:

type property description
zend_class_entry* ce class entry for the class, contains methods and other info
HashTable* properties property table for this class
HashTable* guards protects the class from __get/__set ... recursion

zend_object_value

Properties:

type property description
zend_object_handle handle object's handle id in the object table
zend_object_handlers* handlers

zval

The container used to hold a userspace variable

Properties:

type property description
zvalue_value value actual value contined in this variable
zend_uint refcount number of references to this variable
zend_uchar type type of value contained in this variable, see below
zend_uchar is_ref

Possible values of zval.type

macro value actual value userspace type
IS_NULL 0 null
IS_LONG 1 int
IS_DOUBLE 2 float
IS_BOOL 3 bool
IS_ARRAY 4 array
IS_OBJECT 5 object
IS_STRING 6 string
IS_RESOURCE 7 resource
IS_CONSTANT 8 const
IS_CONSTANT_ARRAY 9

zvalue_value

Holds the values contained in a zval

Properties:

type property description
long lval long value
double dval double value
struct str data structure for a string value, see below.
HashTable* ht hash table value
zend_object_value obj object value

zvalue_value.str Properties:

type property description
char* val string value
int len length of the string value excluding the NULL terminator

Number Types

Types related to int, float, double, long, etc.

zend_intptr_t

A long integer

Internally, zend_intptr_t is an '__int64' on Win64 platforms and a 'long' on non Win64 Platforms.
Example:

zend_intptr_t* myint;

zend_object_handle

Internal handle for objects in the object table

Internally, zend_object_handle is an 'unsigned int'.
See: Revamped object model using object handles

zend_uint

An unsigned integer

Internally, zend_uint is an 'unsigned int'.
Example:

zend_uint myint;

zend_uintptr_t

An unsigned long integer

Internally, zend_uintptr_t is an 'unsigned __int64' on Win64 platforms and an 'unsigned long' on non Win64 Platforms.
Example:

zend_uintptr_t* myint;

zend_ulong

An unsigned long integer

Internally, zend_ulong is an 'unsigned long'.
Example:

zend_ulong mylong;

zend_ushort

An unsigned short

Internally, zend_ushort is an 'unsigned short'.
Example:

zend_ushort myshort;