
:
Y si usas matrices?
Código php:
Ver original 1 => 0, 2 => 1, 3 => 0, 4 => 1, 5 => 0,
6 => 1, 7 => 0, 8 => 0, 9 => 1, 10 => 1,
11 => 0, 12 => 0, 13 => 0, 14 => 1, 15 => 1,
16 => 0, 17 => 1, 18 => 1, 19 => 1, 20 => 1,
21 => 1, 22 => 0, 23 => 1, 24 => 1, 25 => 1,
26 => 1, 27 => 0, 28 => 0, 29 => 1, 30 => 1
);
Aquellos con valor 1 son ocupados, los de valor 0 son libres.
Ahora, podrías usar tambien matrices tipo plano cartesiano:
Código php:
Ver original 0 => array(0 => 0, 1 => 1, 2 => 0, 3 => 0, 4 => 1), 1 => array(0 => 1, 1 => 0, 2 => 1, 3 => 0, 4 => 1), 2 => array(0 => 1, 1 => 1, 2 => 1, 3 => 1, 4 => 0), 3 => array(0 => 0, 1 => 0, 2 => 0, 3 => 1, 4 => 1), 4 => array(0 => 1, 1 => 1, 2 => 1, 3 => 1, 4 => 0) );