|
Posted by Henk Verhoeven on 10/21/05 00:16
Thomas,
Maybe debug_zval_dump() can be of use for getting an unique key? See
http://www.php.net/manual/en/function.debug-zval-dump.php
(the part about refcount is confusing, but maybe you do only need the
first (string(11)) part of the output)
Greetings,
Henk Verhoeven,
www.phpPeanuts.org.
Thomas Mlynarczyk wrote:
> Also sprach Henk Verhoeven:
>
>
>>Your problem: php has no Set. But you can use an associative array and
>>add unique keys for each node, with some not-null value as value.
>>Something like this:
>>$visitedKeys[getUniqueKey($node)] = true;
>>Now you can check wheather the node was already visited by:
>>isSet($visitedKeys[getUniqueKey($node)])
>
>
> Thank you for your suggestion. The only problem is the getUniqueKey()
> function. The only way I can think of is adding another special index to
> each (sub-)array, but then I would a) modify the array and b) still not know
> how to find a suitable key name (must be the same for all and one that is
> not used in the tree structure). It is not possible to directly access the
> symbol table?
>
> Greetings,
> Thomas
>
>
Navigation:
[Reply to this message]
|