diff --git a/internals2/variables/index.xml b/internals2/variables/index.xml
index 1490659e61..61fcd19e23 100644
--- a/internals2/variables/index.xml
+++ b/internals2/variables/index.xml
@@ -206,7 +206,7 @@ typedef union _zvalue_value {
- Please check the chapter for details how reference counting and references work.
+ Please check the chapter for details how reference counting and references work in detail.
Reference Count Manipulation
@@ -343,7 +343,7 @@ typedef union _zvalue_value {
- Objects and Resources have a secondary reference counting ability, when zval_ptr_dtor is called on either, their appropriate del_ref method is executed. See Working with Objects and Working with Resources for more information.
+ Objects and Resources have a reference count as part of their respective structures, when zval_ptr_dtor is called on either, their appropriate del_ref method is executed. See Working with Objects and Working with Resources for more information.
PHP is weakly typed, as such the engine provides API functions for converting variables from one type to another.
@@ -614,11 +614,11 @@ typedef union _zvalue_value {
Working with HashTable
- The HashTable structure serves many purposes in PHP and can be found everywhere, a good understanding of it's functionality is a preqrequisite of being a good Hacker
.
+ The HashTable
structure serves many purposes in PHP and can be found everywhere, a good understanding of it's functionality is a preqrequisite of being a good Hacker
.
- The HashTable implemented by the engine is a standard HashTable, that is to say, a key = > value based store, where the keys are always strings, whose hashes are calculated with a built in hashing algorythim zend_inline_hash_func(const char* key, uint length)
, which results in good distribution, and reasonable usage.
+ The HashTable
implemented by the engine is a standard HashTable
, that is to say, a key => value based store, where the keys are always strings, whose hashes are calculated with a built in hashing algorythim zend_inline_hash_func(const char* key, uint length)
, which results in good distribution, and reasonable usage.
- The internal structure and exact operation of HashTables are out of the scope of this document, this document serves to inform you of the API's available and how best to use them. For a more detailed picture of the HashTable see Zend/zend_hash.h
.
+ The internal structure and exact operation of HashTable
is out of the scope of this document, this document serves to inform you of the API's available and how best to use them. For a more detailed picture of the HashTable see Zend/zend_hash.h
.
Unless otherwise stated, these functions all return FAILURE
if the requested opeation fails for any reason, otherwise SUCCESS
is returned.
@@ -659,7 +659,7 @@ typedef union _zvalue_value {
- searches the table for key
, setting *data
and returning SUCCESS when it is found.
+ searches the table for key
, setting *data
and returning SUCCESS if it is found.
@@ -687,67 +687,66 @@ typedef union _zvalue_value {
zend_hash_* functions that accept void* data
should normally cast it to (void**)
(ie, (void**) &data
)
-
Traversing the HashTable is often necessary, to do this you provide a pointer to a HashTable
, with an optional HashPosition
- a structure internal to the HashTable API that allows traversal not to affect the internal position of HashTable. The following traversal functions are provided, and an example usage found below.
- HashTable Traversal API
-
-
-
- int zend_hash_internal_pointer_reset(HashTable* ht)
-
-
- resets the internal pointer of ht
to the start
-
-
- int zend_hash_internal_pointer_reset_ex(HashTable* ht, HashPosition position)
-
-
- sets position
the the start of ht
-
-
- int zend_hash_get_current_data(HashTable* ht, void* data)
-
-
- gets the data at the current position in ht
, data
should be cast to void**
, ie: (void**) &data
-
-
- int zend_hash_get_current_data_ex(HashTable* ht, void* data, HashPosition position)
-
-
- sets data
to the data at position
in ht
-
-
- int zend_hash_get_current_key(HashTable* ht, void* data, char**key, uint klen, ulong index, zend_bool duplicate)
-
-
- sets key
, klen
, and index
from the key information at the current position. The possible return values HASH_KEY_IS_STRING and HASH_KEY_IS_LONG are indicative of the kind of key found at the current posision.
-
-
- int zend_hash_get_current_key_ex(HashTable* ht, void* data, char**key, uint klen, ulong index, zend_bool duplicate, HashPosition position)
-
-
- sets key
, klen
, and index
from the key information at position
. The possible return values HASH_KEY_IS_STRING and HASH_KEY_IS_LONG are indicative of the kind of key found at position
.
-
-
- int zend_hash_move_forward(HashTable* ht)
-
-
- moves the internal pointer of ht
to the next entry in ht
-
-
- int zend_hash_move_forward_ex(HashTable* ht, HashPosition position)
-
-
- moves position
to the next entry in ht
-
-
+ HashTable Traversal API
+
+
+
+ int zend_hash_internal_pointer_reset(HashTable* ht)
+
+
+ resets the internal pointer of ht
to the start
+
+
+ int zend_hash_internal_pointer_reset_ex(HashTable* ht, HashPosition position)
+
+
+ sets position
the the start of ht
+
+
+ int zend_hash_get_current_data(HashTable* ht, void* data)
+
+
+ gets the data at the current position in ht
, data
should be cast to void**
, ie: (void**) &data
+
+
+ int zend_hash_get_current_data_ex(HashTable* ht, void* data, HashPosition position)
+
+
+ sets data
to the data at position
in ht
+
+
+ int zend_hash_get_current_key(HashTable* ht, void* data, char**key, uint klen, ulong index, zend_bool duplicate)
+
+
+ sets key
, klen
, and index
from the key information at the current position. The possible return values HASH_KEY_IS_STRING and HASH_KEY_IS_LONG are indicative of the kind of key found at the current posision.
+
+
+ int zend_hash_get_current_key_ex(HashTable* ht, void* data, char**key, uint klen, ulong index, zend_bool duplicate, HashPosition position)
+
+
+ sets key
, klen
, and index
from the key information at position
. The possible return values HASH_KEY_IS_STRING
and HASH_KEY_IS_LONG
are indicative of the kind of key found at position
.
+
+
+ int zend_hash_move_forward(HashTable* ht)
+
+
+ moves the internal pointer of ht
to the next entry in ht
+
+
+ int zend_hash_move_forward_ex(HashTable* ht, HashPosition position)
+
+
+ moves position
to the next entry in ht
+
+
- The functions above allow traversal over a HashTable
to look much like a normal loop, which will look something like:
+ The functions above allow traversal over a HashTable
to be much like a normal loop, which will look something like:
-
+
If a HashTable
has been passed into the engine, it is a good idea to use the zend_hash_*_ex API to avoid unexpected behaviour in userland.
@@ -781,9 +780,9 @@ for (zend_hash_internal_pointer_reset_ex(ht, &position);
If a duplicate
of the key is requested and HAS_KEY_IS_STRING
is returned the caller must efree
the duplicated key
-
+