Reply to Multidimensional array - search for relationships

Your name:

Reply:


Posted by LittleCake on 12/02/07 17:33

Hi All,
I have a multidimensional array where each sub-array contains just two
entries, which indicates a relationship between those two entries. for
example the first sub-array:
[0] => Array
(
[0] => 30
[1] => 31
)

This states that value 30 is related to 31. I would like to search
through the entire multidimensional array (it could be empty or
contain hundreds of entries), to see if multiple relationships exist
and hence group these relationships into one entry. so for the array
below:

Array
(
[0] => Array
(
[0] => 30
[1] => 31
)

[1] => Array
(
[0] => 29
[1] => 26
)

[2] => Array
(
[0] => 29
[1] => 27
)

[3] => Array
(
[0] => 29
[1] => 28
)

[4] => Array
(
[0] => 26
[1] => 27
)

[5] => Array
(
[0] => 27
[1] => 28
)
)

This should be represented as:
Array
(
[0] => Array
(
[0] => 30
[1] => 31
)

[1] => Array
(
[0] => 29
[1] => 26
[2] => 27
[3] => 28
)
)

I am new enough to PHP so I would appreciate your help.
Thanks

[Back to original 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

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