You are here: Re: Detecting Recursion « PHP Programming Language « IT news, forums, messages
Re: Detecting Recursion

Posted by Thomas Mlynarczyk on 10/19/05 22:16

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация