4
How to join two arrays being the index of the array 1
follow the index of the array 2
.
Data for joining:
descricao
array1= datacol1, datacol2, datacol3, datacol4
array2= collinha1, collinha2, collinha3 ,collinha4
Print like this:
Description, datacol1, collinha1
Description, datacol2, collinha2
Description, datacol3, collinha3
Description, datacol4, collinha4
<?php
$desc1 = 'Listar=';
$nome['24-01-2016'] = 'João';
$nome['25-01-2016'] = 'Telma';
$nome['26-01-2016'] = 'Joana';
$nome['27-01-2016'] = 'Thiago';
$nome['28-01-2016'] = 'Marcio';
$nome['29-01-2016'] = 'Juliana';
$nome['30-01-2016'] = 'Marcos';
$nome['31-01-2016'] = 'Mariana';
foreach($nome as $indice => $valor){
print $desc1;
print '=>>>';
print $indice;
print '-';
print $valor;
print'<br>';
}
?>
Where does the description come from? And do you really want to put the two together (three?) or just print together? They are different things. To put two together arrays "side by side" can be used
array_combine ( array $keys , array $values )
, but your question needs to define better what you want. It has numerous ways to mess with arrays in PHP. I recommend [Edit] the question and clarify it better, before the staff start answering in "kick".– Bacco
i edited the post put the code I managed to do I took the Dice and put the dates see so.
– gezer
tried to merge an array and then a Sorting ?
– Gabriel Rodrigues
got here i changed made the ivcs scheme gave me more right way. but this way it also looks good.
– gezer
I ask you to take a look at my answer, just to know how to treat cases of iterating two arrays, but the same with different sizes.
– Wallace Maxters