Okay, so the question is awkwardly worded, but I hope this clarifies the situation.
I have this sample 2d array.
$array = array(
array(1, 0, 0, 0, 1, 0, 0, 1),
array(0, 0, 1, 1, 1, 1, 0, 1),
array(0, 1, 1, 0, 1, 0, 0, 0),
array(0, 1, 1, 0, 0, 0, 1, 0),
array(1, 0, 0, 0, 1, 1, 1, 1),
array(0, 1, 1, 0, 1, 0, 1, 0),
array(0, 0, 0, 0, 0, 0, 0, 1)
);
When it repeats with lines (and ends each line with \ n), and for each line, iterating through the column, it will repeat something like this: (ββ = 0, ββ = 1)
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
But what I would like to do is to "parse" the array and leave only one adjacent form (the one that contains most of the "cells"), in this example the result would be:
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
ββββββββββββββββ
My initial approach was as follows:
Assign a unique number to each ββ-cell (whether it is completely random or the current iteration number):
01 02 03
04050607 08
0910 11
1213 14
15 16171819
2021 22 23
24
, : , ββ . , . :
01 21 08
21212121 08
2121 21
2121 24
21 24242424
2121 24 24
24
. , , , , 0, .
, , , . , !
BONUS POINTS: 2D-, , - blob,