I have an array with data and I have to put them into a table. Array:
array(
0=>1
1=>Jon
2=>[email protected]
3=>2
4=>Doe
5=>[email protected]
6=>3
7=>Foo
8=>[email protected])
So Table head is:
<table>
<head>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
</table>
If I go and loop through the array:
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
@foreach($array as $data)
<tr>
<td>
{{$data}}
</td>
</tr>
@endforeach
<tbody>
</table>
Current Output:
Id Name Email
1 Jon [email protected] 2 Doe [email protected] 3 Foo [email protected]
But My desired output is:
Id Name Email
1 Jon [email protected]
2 Doe [email protected]
3 Foo [email protected]
I tried to chunk array into arrays with array_chunk() but the result was the same.
I am on laravel but I can go with plain php also. Any tips would be much apreciated.