As using php in a foreach loop to generate the table with two variables in each row? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

As using php in a foreach loop to generate the table with two variables in each row?

The generation of a table in php.

21st Oct 2017, 7:26 PM
Станислав Пыхтин
Станислав Пыхтин - avatar
2 Answers
0
I understand that it is necessary to use a counter loop. But how to set the condition for the insertion of the tags <th> and <tr>?
21st Oct 2017, 7:28 PM
Станислав Пыхтин
Станислав Пыхтин - avatar
0
<table> $num = 0; forearch... { if (($num %2) ==0) {<tr>} if (?) {<th>} ... $num++; } </table> Something like this, but I can't.
21st Oct 2017, 7:40 PM
Станислав Пыхтин
Станислав Пыхтин - avatar