Use Loop inside loop for for/while condion to fill table row by row

I have oracle function which return for me 1 long string. I used preg_split to convert string to array(string devided by comma).

$keywords = preg_split("/[/s,]+/", $oracle_return);

Now I can get data as array $keywords[1], $keywords[2] and etc. I have 73 parts of array. I need to fill these values to table which consist of 7 columns and 12 rows. So here is my code. I want to use loop which will do same as this example bellow(It will bring me all values from my query row by row):

while($row = sqlsrv_fectch_array($connection,$query))

echo "<td>".$fist_column."</td>";

Here is my loop which I want to fill table with data row by row 7X12.
Question: How can I add +1 to $x for each step?

while($i<=12)     //Or i can use for($i=0;$i<=12;$i++)
  echo "
    <td>".$year. "</td>
    <td>".$month. "</td>
    <td>".$keywords[$x]. "</td>     //if $x=1 so, equal to $keywords[1]
    <td>".$keywords[$x+1]. "</td>   //$keywords[2]
    <td>".$keywords[$x+2]. "</td>   //$keywords[3]
    <td>".$keywords[$x+3]. "</td>   //$keywords[4]
    <td>".$keywords[$x+4]. "</td>   //$keywords[5]

Is this what you are looking for?
It will output the 72 items, 6on each line.

$keywords = range(1,73);
$year ="year";
$month ="month";
//For loop to 72
  echo "
    <td>".$year. "</td>
    <td>".$month. "</td>
    // Output the keywords
    <td>".$keywords[$i]. "</td>
    <td>".$keywords[$i+1]. "</td>
    <td>".$keywords[$i+2]. "</td>
    <td>".$keywords[$i+3]. "</td>
    <td>".$keywords[$i+4]. "</td>
    <td>".$keywords[$i+5]. "</td>
    $i =$i +6; // add six to i to make sure it does not repeat itself.

I used a range just to make an example that works when you run it but you have to change that to your code.

This will not output the last item but since you know it’s item 73 you can easily output it with echo $keywords[73]

I’ve just assumed that you want 6 items on each row (as in your last code example). The data I’ve populated is purely to show the results…

error_reporting ( E_ALL );
ini_set ( 'display_errors', 1 );

$arraySize = 73;
$keywords = [];
for ( $i = 0; $i < $arraySize; $i++ )   {
    $keywords[] = $i+1;

for ( $i = 0; $i < $arraySize; $i++ )   {
    if ( $i % 6 == 0 )  {
        if ( $i > 0 )   {
            echo "</tr>".PHP_EOL;
        echo "<tr>";
    echo "<td>".$keywords[$i]."</td>";
echo "</tr>".PHP_EOL;

Which outputs…