1
I intend to play to the end of the list the variables that are null
. This is part of the composition of the elements of view, are blocks that can come empty, and I want to avoid having to compare the variables and regroup. How can I redo the display order of the elements on the page by throwing the empty items to the end?
In the example below I have the variables A, B and C, in the normal case would make a foreach( $variavel_X as $linha )
and would have:
$variavel_A: nada aqui
$variavel_B: [ 'linha 1' , 'linha 2' , 'linha 3' ]
$variavel_C: [ 'linha 1' , 'linha 2' , 'linha 3' ]
What I need is to display as in the order below, where the empty variable appears last
$variavel_B: [ 'linha 1' , 'linha 2' , 'linha 3' ]
$variavel_C: [ 'linha 1' , 'linha 2' , 'linha 3' ]
$variavel_A: nada aqui
I thought of playing the variables in an array and reordering with arsort
, but the function will make the order ascending(a-z) or descending(z-a), and that does not interest me much.
$variavel_A, B, C are positions of an array?
array('variavel_A' => array('linha1','linha2','linha3'))
– Don't Panic
In this case they are not, but I can play in an array if necessary to resolve the issue. Suggestion?
– Papa Charlie