Jump to content

okabe

New Members
  • Posts

    1
  • Joined

  • Last visited

okabe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi everyone, i have some troubles to solve this "grouping" problem. I have 2D (nxn) array and i want to group all related item to groups. Items are considered to be related in 2 cases: when they have the same edge or top. $table = array( array( 0, 0, 0, 0, 0, 0), array( 0, 0, 1, 2, 0, 0), array( 0, 0, 0, 0, 0, 0), array( 0, 3, 0, 4, 0, 0), array( 0, 0, 5, 0, 0, 0), array( 0, 0, 0, 6, 0, 7) ); And this is result which i want to achieve : $groups= array( array( 1, 2), array( 3, 4, 5, 6), array( 7 ), ); I will be grateful for any help. THX
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.