Print Array to table | بلاگ

Print Array to table

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

I have an array with data and I have to put them into a table. Array:

array(
 0=>1
 1=>Jon
 2=>jon@email.com
 3=>2
 4=>Doe
 5=>doe@email.com
 6=>3
 7=>Foo
 8=>foo@email.com)

So Table head is:

ID Name Email

If I go and loop through the array:

 
       @foreach($array as $data)
            
       @endforeach
    
ID Name Email
{{$data}}

Current Output:

Id   Name  Email
1   Jon  jon@email.com 2 Doe doe@email.com  3  Foo foo@email.com

But My desired output is:

Id   Name  Email
 1   Jon   jon@email.com
 2   Doe   doe@email.com
 3   Foo   foo@email.com

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.

asked 51 secs ago
Davis

...
نویسنده : استخدام کار بازدید : 0 تاريخ : جمعه 23 شهريور 1397 ساعت: 12:24