How do I distribute values of an array in three columns?

前端 未结 5 2105
醉话见心
醉话见心 2020-12-11 06:56

I need this output..

1 3 5
2 4 6

I want to use array function like array(1,2,3,4,5,6). If I edit this array like array(1

5条回答
  •  眼角桃花
    2020-12-11 07:53

    one solution is : your array has N elements, and you want 3 columns, so you can get the value of each cell with $myarray[ column_index + (N/3) + line_index ] (with one or two loops for columns and lines, at least for lines) I hope this will help you Bye

提交回复
热议问题