hash table guidance?
| From: | J. Adams | Date: | Wed, 02 Nov 2011 17:31:28 +0000 |
| Subject: | hash table guidance? | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-8792@lists.php.net to get a copy of this message | ||
I'm in the process of updating the AMFEXT extension. Specifically, I'm trying to serialize objects and arrays. I'm using the JSON extension as my guide and I'm a bit confused about how to handle PHP's hash table object. Can anyone direct me to a primer or introduction that explains how to deal with arrays/objects/hashtables?
I would also appreciate recommendations or advice on how to accomplish the following:
* determine if array keys are all numeric and contiguous or, if the array/object has associative keys or non-contiguous, detect that condition.
* detect if the current value to be serialized has been encountered before during the serialization of a particular object -- e.g., if a single array array or object appears more than once in a particular object via recursion or by referenced. I suspect this requires me to check the pointer fed to my function, but am unsure whether to dereference the pointer.
For anyone who is curious, I'm implementing AMF3 serialization and deserialization as described in this document:
http://download.macromedia.com/pub/labs/amf/amf3_spec_121207.pdf
I have already done this in PHP and the function is fairly elaborate:
http://flashmog.net/server_source_docs/current/__filesource/fsource_FlashMOG_FlashMOG_Server_fm_includesclassesSerializer_AMF3.php.html#a515