columns, loop, rows, php, table, PHP looping table columns and rows, Shopinson, Shopinson

Shopinson codes today again is on ‘PHP looping table columns and rows

This code for PHP looping table columns and rows have been a long SEARCH on google as far I can know and REASONS because so many developers both beginners and the professional might want to create something alike that will automatically create a table and loop the row or column based on the intellectual need of either developers.

columns, loop, rows, php, table, PHP looping table columns and rows, Shopinson, Shopinson

PHP looping table

See also : Python listing files contained a defined directory

For example : below is a code (PHP) that will create 7 by 3 table automatically

<?php //Refresh it everytime.

$row = 7; //The Needed numbers of Row

$col = 3; // The Needed numbers of Column

$numbering= 1; // This will loop the numbers contained in each cell using $numbering++ (auto increment function php loop)

echo '<table border="1">';

for($i=1;$i<=$row;$i++){ echo '<tr>';

  for($j=1;$j<=$col;$j++){ echo '<td>'. $numbering++ .'</td>'; }

  echo '</tr>';


echo '</table>';

Result: PHP codes above created 7rows and 3 columns

In the above code just by manipulating (changing) the number values in the either of the variables $row or $col for the table column or row then the table will be altered automatically and respectively and you will have the actually number values of columns or rows you input right your desired table for any of your desired purpose.

see also:

Now notice that the PHP variable $numbering loops numbering continuously across the cells in the table without that variable that loops continuous numbering across the cell the code will misbehave

The variable $row represent the row of the table while the $col represent the column

Basically the row or a column of a table in Php are LOOPED predominantly using for loop command.

see also:

Running metasploit framework on windows OS


Leave a reply

Your email address will not be published. Required fields are marked *



©2020 Shopinson: complete guide to programming language


We're not around right now. But you can send us an email and we'll get back to you, asap.


Log in with your credentials


Forgot your details?

Create Account