I am having multiple indexed array,here the index changing dynamically.Actually the index of the arrays are id's of group.How can i pass these array in to foreach loop
Array
(
[0] => Array
(
[462] => Array
(
[0] => Array
(
[group_name] => First
[invoice_no] =>
)
[1] => Array
(
[invoice_no] =>
[invoice_no] => 2Q
)
)
[525] => Array
(
[0] => Array
(
[group_name] => Second
[invoice_no] =>
)
[1] => Array
(
[group_name] =>
[invoice_no] => 3QW
)
)
)
)
This is my array structure,Please help me to print results using foreach loop in php with out changing array structure
I am trying this code
foreach ($Sale_list_array as $key => $value) {
echo ($key);
echo $value[$key][group_name];
}
But,this won't fix my problem. I am hoping output like this in table structure
<table>
<thead>
<tr>
<td>Group</td>
<td>Invoice</td>
</tr>
</thead>
<tbody>
<tr><td>First</td><td></td></tr>
<tr><td></td><td>2Q</td></tr>
<tr><td>Second</td><td></td></tr>
<tr><td></td><td>3QW</td></tr>
</tbody>
</table>
$arrayVariable[$keyVariable] = $valueVariable;this will create your array with dynamic key and value$keyas key of new array and$value[$key][group_name]as value?