.tabela-grid{
margin: 0;
display: table;
width: 100%;
}
.tabela-grid *{
vertical-align: top;
text-align: center;
}
.tabela-grid img{
width: 100%;
display: inline-block;
}
.tabela-columm{
display: table-cell;
}
.tabela-columm:nth-child(even) .tabela-cell{
display: table;
}
.tabela-cell{
display: table-cell;
}
<div class="tabela-grid">
<div class="tabela-columm" style="background-color: red">
item1 </div>
<div class="tabela-columm" style="background-color: green">
<div class="tabela-cell">item2</div>
<div class="tabela-cell">item3</div>
</div>
<div class="tabela-columm" style="background-color: red">
item4 </div>
<div class="tabela-columm" style="background-color: green">
<div class="tabela-cell">item5</div>
<div class="tabela-cell">item6</div>
</div>
</div>
I have array
that comes with the following content:
array (size=6)
0 =>
array (size=6)
'href' => string 'href'
'likes' => int 2
'img' => string 'href'
'text' => string 'comentario'
'width' => int 370
'height' => int 370
1 =>
array (size=6)
'href' => string 'href'
'likes' => int 12
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
2 =>
array (size=6)
'href' => string 'href'
'likes' => int 7
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
3 =>
array (size=6)
'href' => string 'href'
'likes' => int 1
'img' => string 'href'
'text' => string 'comentario'
'width' => int 370
'height' => int 370
4 =>
array (size=6)
'href' => string 'href'
'likes' => int 6
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
5 =>
array (size=6)
'href' => string 'href'
'likes' => int 5
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
I need to convert it to this format:
array (size=2)
0 =>
array (size=2)
0 =>
array (size=6)
'href' => string 'href'
'likes' => int 2
'img' => string 'href'
'text' => string 'comentario'
'width' => int 370
'height' => int 370
1 =>
array (size=2)
0 =>
array (size=6)
'href' => string 'href'
'likes' => int 12
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
1 =>
array (size=6)
'href' => string 'href'
'likes' => int 7
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
1 =>
array (size=2)
0 =>
array (size=6)
'href' => string 'href'
'likes' => int 2
'img' => string 'href'
'text' => string 'comentario'
'width' => int 370
'height' => int 370
1 =>
array (size=2)
0 =>
array (size=6)
'href' => string 'href'
'likes' => int 12
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
1 =>
array (size=6)
'href' => string 'href'
'likes' => int 7
'img' => string 'href'
'text' => string 'comentario'
'width' => int 175
'height' => int 175
Is it possible to do this? I'm doing some testing so I've simplified the data to make it easier, but I still have not been able to do it:
$entrada = array( 'item1', 'item2', 'item3', 'item4', 'item5', 'item6');
$saida= array(
0 => array( 0 => 'item1', 1 => array(0 => 'item2', 1 => 'item3') ),
1 => array( 0 => 'item4', 1 => array(0 => 'item5', 1 => 'item6') ),
);